Gradle Build Failed - Java.exe Is Finished With Non-zero Exit Value 2
Solution 1:
It looks like you have reached the dex limit and you have over 65k methods in your application.
If you want to keep all of your gradle dependencies as is, you should look into configuring multidex that way it will build your application using multiple dex files.
Another solution would be to try and remove any unnecessary dependencies from the google play services library. Chances are you don't need to include everything and you can choose to add only the imports you need.
For example:
com.google.android.gms:play-services-maps:7.5.0com.google.android.gms:play-services-gcm:7.5.0
Rather than simply using:
compile'com.google.android.gms:play-services:7.5.0'
You can reference the Google Play Services guide to determine which pieces of library you should add.
Solution 2:
Android Studio suggests,
Avoid using + in version numbers can lead to unpredictable and unrepeatable builds.
+ in dependencies lets you pick up automatically the latest available version rather than a specific one, however this is not recommended.
You may have tested with a slightly different version than what build server used.
After Removing Plus Sign and Adding a Specific Version problem was solved.
Post a Comment for "Gradle Build Failed - Java.exe Is Finished With Non-zero Exit Value 2"