Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"java.exe" exited with code 2

I added Google play services to my project for maps but now keep getting this error "java.exe" exited with code 2. I am not sure if it is different from "java.exe" exited with code 1 but I have tried all the suggestions online My heap size is 1G. My target version is 21, I have clean rebuild etc.. When I click on the error it takes me to this CompileToDalvik. How can I resolve this? Even if I remove google play services I still get this error( clean / refresh rebuild etc..)

like image 597
Charl Potgieter Avatar asked Jul 28 '15 07:07

Charl Potgieter


3 Answers

Using Visual Studio and Xamarin I got this error because I had a wrong path for the Keystore in the .csproj file, and for some reason this path did not get updated while changing the path for the Keystore in the Visual Studio GUI. Manual correcting the path in the .csproj file solved it for me.

like image 25
René AD Avatar answered Oct 18 '22 11:10

René AD


We had similar issues and nailed it down to our app going over 64k (65,536) methods limit which could be what's happening when you reference google play services.

Enabling multidex resolved our issue so may be worth trying.

Google Multi-Dex Reference: http://developer.android.com/tools/building/multidex.html

like image 55
KrustyGString Avatar answered Oct 18 '22 12:10

KrustyGString


None of the others answers worked for me. What worked for me (but I don't know why) was to empty my bin and obj directories before doing a rebuild.

like image 40
ED-209 Avatar answered Oct 18 '22 12:10

ED-209