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

Solution 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.

Solution 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

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

Solution 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.

Solution 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.