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

ぃ、小莉子 提交于 2019-11-26 22:50:18

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.

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

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 :)

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.

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.

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'

}

Remove compile 'com.parse:parse-android:1.+'

add this linecompile fileTree(dir: 'libs', include: ['Parse-*.jar'])

Finally, it will look like this

dependencies {
compile fileTree(dir: 'libs', include: ['Parse-*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.android.support:design:22.2.0'
compile 'com.parse.bolts:bolts-android:1.+'
}

I was using the robolectric dependency in my android project. I removed all robolectric dependencies in gradle and deleted all my robolectric tests, then I built the app and finally I could run the android project. Hope this can work for us.

I faced the same problem when trying to add the SignalR Java client library to my project's dependencies. I first changed the target JDK of my app from 1.8.0_XX to 1.7.0_XX, but it didn't work. Then I changed the SignalR project to target 1.7.0_XX as well, rebuilt and added it to my project's libs folder instead of the first build (which was in 1.8.0_XX), and that miraculously worked.

For me, the problem was that I was using different versions of "Google Play services sub API's"

Before: Click to see the image

After: Click to see the image

I had the same problem, just i did Biuld--> Rebiuld project and it works again ;)

Check if there are 2 classes with same name. Each class name should be unique.

maybe for this issue you got means you added same liberay file in more than one time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!