gpt4 book ai didi

android - 当我尝试编译代码时,任务 ':app:dexDebug'的执行失败

转载 作者:行者123 更新时间:2023-12-03 06:25:50 25 4
gpt4 key购买 nike

当我尝试编译代码时,出现以下错误:

Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2


buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.19.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }

}

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.example"
minSdkVersion 14
targetSdkVersion 22
versionCode 20012
versionName '2.3.3'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
proguardFile '/My Workspace/FirstApp/proguard-android.txt'
debuggable false
multiDexEnabled true
}
debug {
minifyEnabled false
debuggable true
proguardFile '/My Workspace/FirstApp/proguard-android.txt'
}
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'LICENSE'
exclude 'license.txt'
}
productFlavors {
}
}

dependencies {
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.google.code.gson:gson:2.3.1'
compile files('libs/AF-Android-SDK-v2.3.1.17.jar')
compile 'com.squareup.okio:okio:1.4.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:design:22.2.1'
compile 'com.commonsware.cwac:anddown:0.2.+'
}

解:

将单独的api库用于Google定位服务/ gcm,并删除了完整的play服务库。这减少了可靠的库方法,并解决了错误。

最佳答案

太笼统了,但是有两个原因导致您收到此错误
1.在build.gradle中检查dependencies{}。您必须依赖于重复的库。
更多详细信息:Check out my website
2.编译时放大build.gradle中的堆大小

android {
...
dexOptions{
incremental true
javaMaxHeapSize "4g"
}
}

关于android - 当我尝试编译代码时,任务 ':app:dexDebug'的执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33967894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com