Appcenter-sdk-dotnet: urgent: "java.exe" exited with code 2

Created on 29 Apr 2017  路  12Comments  路  Source: microsoft/appcenter-sdk-dotnet

Installing the latest nugets from Mobile Center
Microsoft.Azure.Mobile
Microsoft.Azure.Mobile.Analytics
Microsoft.Azure.Mobile.Crashes

Breaks Xamarin Forms android with error _"java.exe" exited with code 2_

Please can we have a fix or work around on urgent basis, I have a release pending.

Most helpful comment

Hi, are you using Java 8 which is a requirement for our product?

If yes we need much more details from the build log. if not you have to upgrade your build to use Java 8.

Please enable diagnostic level on build output and provide the build error details.
https://forums.xamarin.com/discussion/27515/how-to-obtain-diagnostic-build-logs

Also we have a support center that we recommend using in our README instead for issues like this so that we can notice it sooner.

All 12 comments

Hi, are you using Java 8 which is a requirement for our product?

If yes we need much more details from the build log. if not you have to upgrade your build to use Java 8.

Please enable diagnostic level on build output and provide the build error details.
https://forums.xamarin.com/discussion/27515/how-to-obtain-diagnostic-build-logs

Also we have a support center that we recommend using in our README instead for issues like this so that we can notice it sooner.

(Please also look at https://forums.xamarin.com/discussion/84125/how-to-fix-java-exe-exited-with-code-2)

Short answer: you need to enable "Multi-Dex" in build options.

@supreettare Feel free to reopen the issue if enabling Multi-dex does not work.

Enabling multidex did solve this problem

It did not sovlve my problem @guperrot Please have a look at https://forums.xamarin.com/discussion/84125/how-to-fix-java-exe-exited-with-code-2

@kntiwary are you sure you enabled multi-dex ? What build config are you using and what are your build options?

Another thing to look out for, is the Android Package signing options. I had a project referencing another developers Keystore. Updating the path or unchecking the Sign the .apk file ..... helps

Also, check if the SDK version in the Android Build configuration is set to the right version. ie: when you are targeting 8.X in your Xamarin android project, you need to set the SDK Version to Xamarin.Android 8.x instead of Xamarin.Android 9.x

Does anyone know why enabling multi-dex fixed the issue?

As there is a post saying you dont have to if your minimum SDK version is 21.

If your Android app aims for a minimum SDK version above or equal to API 21 (Android 5.0 Lollipop) it is not necessary to use the MultiDex library, because the OS handles natively the extra .dex files. However, if for compatibility reasons the developer wants to support older Android OS, then he/she should use the MultiDex library.

https://riptutorial.com/xamarin-android/example/29859/enabling-multidex-in-your-xamarin-android-apk

Updating VS Mac, All Nuget Packages and installing/updating the Android Build Tools solved the problem for me!

Was this page helpful?
0 / 5 - 0 ratings