Archiving Android app produces “java.exe exited with code 2” error

Super quick and dirty post about an issue that drove me and another dev crazy for a couple hours. We kept getting this error when trying to archive an Android Xamarin project in Release mode (in Visual Studio 2019), specifically on the signing step:

ERROR: "java.exe" exited with code 2

We noticed a line in the build log which referenced a keystore path that was not a valid path on our machine.

Unload your MyApp.Droid project and edit it. In the Release property group, find the AndroidSigningKeyStore property and make sure it is a valid file path on your machine. If not, don’t update it here. Instead:

  1. Close and reload the project.
  2. Right click the MyApp​.Droid project and click Properties.
  3. On the Android Package Signing tab, check the box to Sign the .APK… and fill in all four fields.
  4. Save the project properties.

Try archiving again and it should (hopefully) work. If not, please add a comment to this post and I may be able to help. I may expand this post with more Google Play console errors and their solutions at some point in the future.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s