找到你要的答案

Q::app:dexDebug ExecException finished with non-zero exit value 2

Q::应用:dexdebug execexception完成非零退出值2

Could anyone help me out with the following error. When i clean the project is show no error but everytime i try to run i get this message.

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

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2

The application was running with no errors but as my system crashed and restarted android studio i had few updates for Android API 22. After the update the application keep giving me this error message. I downloaded JDK 8 and tried to run but didn't work. Later i downgraded to JDK 7 after this stack post but still has not fixed it. Is it possible to use Java 8 for Android development?

I have looked through numerous similar question but none works for me. Some similar issues found on stack were

why java.exe exit with value 1 in android studio

Error:Execution failed for task ':app:dexDebug'. > comcommand finished with non-zero exit value 2

Java finished with non-zero exit value 2 - Android Gradle

java.exe finished with non-zero exit value 2 - After upgrading play service

Process 'command' C: \ Program Files \ Java \ jdk1.8.0_31 \ bin \ java.exe '' finished with a non -zero exit value 2

I have looked through dependencies in gradle built to see if there were any conflict but found none.

I even tried to copy the code into a new project and run it but still no success. Anyone who has faced the same issue and solved it please help me out.

有谁能帮我解决以下错误。当我清理项目是没有错误,但每次我试图运行我得到这个消息。

错误:任务执行失败:应用:dexdebug”。

com.android.ide.common.process.processexception:org.gradle.process.internal.execexception:过程命令C:\程序文件\ \ \ \ java java jdk1.8.0_45仓。exe”完成了非零退出值2

The application was running with no errors but as my system crashed and restarted android studio i had few updates for Android API 22. After the update the application keep giving me this error message. I downloaded JDK 8 and tried to run but didn't work. Later i downgraded to JDK 7 after this stack post but still has not fixed it. Is it possible to use Java 8 for Android development?

我看过无数类似的问题,但没有一个适合我。堆栈上发现一些类似的问题

为什么java.exe退出与Android Studio 1的价值

错误:任务执行失败:应用:dexdebug”。 > comcommand finished with non-zero exit value 2

java完成非零退出值2 - Android Gradle

java.exe完成非零退出值2升级后播放服务

过程命令C:\程序文件\ \ \ jdk1.8.0_31 java bin java.exe”完成了一个非零退出值2

我已看透了依赖Gradle看是否有任何冲突,但是没有找到。

我甚至尝试将代码复制到一个新项目中运行,但仍然没有成功。任何人面对同样的问题并解决它请帮助我。

answer1: 回答1:

After days of trying out finally could fix the issue. The problem with one of my .jar files. I had to remove each jar and check one by one until i found it. I removed the .jar file and cleaned my project and ran successfully. If any one should face similar issue check your jar file one by one.

经过几天的尝试终于可以解决这个问题。我的JAR文件的问题。我必须删除每个罐子,逐一检查,直到我发现它。我删除了JAR文件并清理了我的项目并成功运行。如果任何人都要面对类似的问题逐一检查你的JAR文件。

answer2: 回答2:

I had the same error

app:dexDebug ExecException finished with non-zero exit value 2

i solve it by adding this line of code

defaultConfig {
        multiDexEnabled true
}

The reason is that i was using too many libraries

Hope this post will help anyone

我也有同样的错误

应用:dexdebug execexception完成非零退出值2

我通过添加这行代码来解决它

defaultConfig {
        multiDexEnabled true
}

原因是我用了太多的图书馆

希望这个帖子能帮到任何人

answer3: 回答3:

I had the same problem when I compiled google play services to my dependencies.

My mistake was I was compiling the enitre package like this

compile 'com.google.android.gms:play-services:8.3.0'

Instead when I tried the selective compile, it worked.In my case I was using for google sign in,so it had just had to be

compile 'com.google.android.gms:play-services-auth:8.3.0'.

More details are in the documentaion. https://developers.google.com/android/guides/setup#split

Hope this will be of a little help to someone someday :)

当我将谷歌Play服务编译成我的依赖时,我遇到了同样的问题。

我的错误是我编写的整包这样

编译的COM。谷歌。Android。GMS:播放服务:8.3.0”

相反,当我尝试了选择性编译,它的工作,在我的情况下,我使用谷歌登录,所以它不得不

编译的COM。谷歌。Android。GMS:发挥服务认证:8.3.0”。

更多的细节在文本。http:/ /开发商。谷歌。COM / Android /指导/设置#分裂

希望这会对某人有一点帮助:

answer4: 回答4:

I know it's late. But that's what actually worked for me.

1. Build > Clean Project
2. Close gradle daemon processes (ps -e| grep gradle  //this will list gradle processes)
3. File > Invalidate caches & Restart

I hope this will work for everyone.

I know it's late. But that's what actually worked for me.

1. Build > Clean Project
2. Close gradle daemon processes (ps -e| grep gradle  //this will list gradle processes)
3. File > Invalidate caches & Restart

我希望这将为大家工作。

answer5: 回答5:

For future readers. If you're using your own AARs and upgraded one that has a shared dependency, you can also just try cleaning the project. In Android Studio "Build" -> "Clean Project".

This solved the issue for me, so I'd recommend giving it a quick try before you start digging for dependencies.

面向未来读者。如果你用你自己的阿尔斯和升级一个有一个共同的依赖,你也可以试试清洁项目。在Android的工作室“打造”>;“清洁工程”。

这为我解决了这个问题,所以我建议在你开始挖掘依赖关系之前先给它一个快速的尝试。

answer6: 回答6:

For me the solution was to remove an unnecessary/duplicate dependency entries. This is a similar solution others offered here that makes sense, but not exactly the same solution as those offered by others.

Since I was already including *.jar files in the list of files to be compiled, there was no need for additional entries in the dependencies list.

Before:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}

After:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:22.2.0'

}

对我来说,解决方案是移除一个不必要的/重复的依赖项。这是一个类似的解决方案,其他人在这里提供有道理的,但不完全相同的解决方案所提供的其他人。

因为我已经包含了要编译的文件列表中的JAR文件,所以不需要在依赖项列表中添加其他条目。

之前:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}

后:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:appcompat-v7:22.2.0'

}

answer7: 回答7:
java  android  android-studio  gradle  android-gradle