Java 错误:任务 ':app:dexDebug' 执行失败。com.android.ide.common.process.ProcessException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28917696/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException
提问by Hui
Error:Execution failed for task ':app:dexDebug'.
错误:任务 ':app:dexDebug' 执行失败。
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' finished with non-zero exit value 2
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' 以非完成零退出值 2
I searched all the similar questions and solutions, but they do not help. I hope experts like you come up.
我搜索了所有类似的问题和解决方案,但没有帮助。希望像你这样的专家出现。
The project code has been uploaded into bitbucket: https://[email protected]/tainule/numad-huizhang.git
项目代码已经上传到bitbucket:https://[email protected]/tainule/numad-huizhang.git
I have two modules, app and endpoint. Below is from Module:app:
我有两个模块,应用程序和端点。以下来自模块:应用程序:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "edu.neu.madcourse.huizhang1"
minSdkVersion 14
targetSdkVersion 21
versionCode 3
versionName "2.1"
// multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:21.0.+"
compile 'com.google.android.gms:play-services:+'
compile 'com.google.guava:guava:18.0'
compile 'com.google.code.gson:gson:1.7.2'
compile 'org.apache.httpcomponents:httpmime:4.4-beta1'
compile 'org.apache.httpcomponents:httpclient:4.4-beta1'
compile 'org.apache.httpcomponents:httpcore:4.4-beta1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile project(path: ':endpoint', configuration: 'android-endpoints')
compile files('src/main/res/libs/KeyValueAPI.jar')
}
Below is from Module endpoint:
以下来自模块端点:
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.17'
}
}
repositories {
mavenCentral();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.8'
compile 'com.google.appengine:appengine-endpoints:1.9.8'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.8'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:4.0b3'
compile 'com.ganyo:gcm-server:1.0.2'
// compile 'com.github.fengdai:alertdialogpro-theme-material:0.1.0'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
采纳答案by Hui
Finally I solved this problem by changing compile 'com.google.guava:guava:18.0 ' to compile 'com.google.guava:guava-jdk5:17.0'
最后我通过将 compile 'com.google.guava:guava:18.0' 改为 compile 'com.google.guava:guava-jdk5:17.0' 解决了这个问题
回答by cauldyclark
I encountered the same exact error message. I am not quite sure if my solution will solve also your issue.
我遇到了完全相同的错误消息。我不太确定我的解决方案是否也能解决您的问题。
In Project Structure (app) I changed the Compile SDK Version from API 22 to API 21 and changed Build Tools Version from 22.0.0 to 21.1.2.
在项目结构 (app) 中,我将编译 SDK 版本从 API 22 更改为 API 21,并将构建工具版本从 22.0.0 更改为 21.1.2。
When I downloaded the latest API 22 Adroid 5.1, every project I create is using this API and causes me the problem. Maybe, Android Team is looking for a fix for this one.
当我下载最新的 API 22 Adroid 5.1 时,我创建的每个项目都在使用这个 API 并导致我出现问题。也许,Android 团队正在寻找解决此问题的方法。
回答by konmik
I've got this problem after including same classes twice
两次包含相同的课程后我遇到了这个问题
回答by tomisyourname
I have the same issue, and solved by change the '+' to a exact number, like compile "com.android.support:appcompat-v7:21.0.+" to compile "com.android.support:appcompat-v7:21.0.0".
我有同样的问题,并通过将“+”更改为确切数字来解决,例如编译“com.android.support:appcompat-v7:21.0.+”来编译“com.android.support:appcompat-v7:21.0 .0”。
This works for me. :)
这对我有用。:)
回答by Binod Rokka
It seems you have a jar file or a lib appearing multiple times.
您似乎有一个 jar 文件或一个 lib 出现多次。
So, remove the .jar file from the lib folder then:
因此,从 lib 文件夹中删除 .jar 文件,然后:
Build
> Rebuild
Build
> Rebuild
回答by sonph
For me I had multiple versions of the same library included in /app/libs
. I was using Parse and I had both ParseFacebookUtilsV3-1.9.0.jar
and ParseFacebookUtilsV4-1.9.0.jar
.
对我来说,我在/app/libs
. 我正在使用 Parse 并且我同时拥有ParseFacebookUtilsV3-1.9.0.jar
和ParseFacebookUtilsV4-1.9.0.jar
。
Deleting the V3
jar solves the problem.
删除V3
jar 可以解决问题。
回答by Tommy Chan
This could also be the case when you have too many object references. Take a look at the results from the build, esp in the task :dex:multiDebug:
当您有太多对象引用时,也可能出现这种情况。看看构建的结果,特别是在任务 :dex:multiDebug 中:
trouble writing output: Too many method references: 67114; max is 65536.
写入输出时遇到问题:方法引用过多:67114;最大值为 65536。
回答by Beemo
Try to put this line of code in your main projects gradle script:
尝试将这行代码放在您的主要项目 gradle 脚本中:
configurations { all*.exclude group: 'com.android.support', module: 'support-v4' }
I have two libraries linked to my project and they where using 'com.android.support:support-v4:22.0.0'.
我有两个库链接到我的项目,它们使用“com.android.support:support-v4:22.0.0”。
Hope it helps someone.
希望它可以帮助某人。
回答by yabin ya
three condition may cause this issue.
三个条件可能会导致此问题。
- differ module have differ jar
- in libs had contain jar,but in src alse add relevant source
gradle repeat contain,eg:
compile fileTree(include: [‘*.jar'], dir: ‘libs')
compile files(‘libs/xxx.jar')
- 不同的模块有不同的 jar
- 在libs中已经包含了jar,但是在src中也要添加相关的源码
gradle 重复包含,例如:
编译文件树(包括:['*.jar'],目录:'libs')
编译文件('libs/xxx.jar')
if you can read chinese ,read hereError:Execution failed for task ':app:dexDebug'.> com.android.ide.common.process.ProcessException: o
如果您可以阅读中文,请在此处阅读Error:Execution failed for task ':app:dexDebug'.> com.android.ide.common.process.ProcessException: o
回答by Ayaz Alifov
I solved the same issue by removing:
我通过删除解决了同样的问题:
compile fileTree(include: ['*.jar'], dir: 'libs')
and adding for each jar file:
并为每个 jar 文件添加:
compile files('libs/yourjarfile.jar')