![](/img/trans.png)
[英]Error:Execution failed for task ':app:dexDebug'. in android
[英]Error:Execution failed for task ':app:dexDebug' at runtime
我正面临这个运行时错误。它说:
错误:任务 ':app:dexDebug' 执行失败。
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' 以非零退出完成值 2
这是我的 build.gradle 脚本:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.stratbeans.barium.mobilebarium"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/listviewanimations_lib-core-slh_3.1.0.jar')
compile project(':ListViewAnimations-core')
compile project(':StickyListHeaders')
compile project(':ListViewAnimations-core-slh')
请帮帮我。谢谢!
您应该审核您的项目是否存在不需要的依赖项,并使用 ProGuard 删除尽可能多的未使用代码。
修改您的应用程序 Gradle 构建文件配置以包含支持库并启用多索引输出。
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.stratbeans.barium.mobilebarium"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
有关详细信息,您可以访问我的回答DexIndexOverflowException Only When Running Tests
defaultConfig {
multiDexEnabled true
}
在 build.gradle 的 defaultConfig 中添加 multiDexEnabled true。
希望这对你有用!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.