Error "java.exe" has exited with code 2 when adding nuget package

krishnamvermakrishnamverma USMember ✭✭
edited March 27 in Xamarin.Forms

I have a Xamarin.Forms project in which I am trying to use Urbanairship for receiving push notifications. My project already contains many nuget packages which are required for other functionalities. Urbanairship implementation is working fine in iOS project but when I add corresponding nuget package to Android project, I get compile time error as "java.exe" has exited with code 2. I checked regarding this on forums and many has pointed that this may be related with Dalvik 25k limitation for Android. As a solution its mentioned that I should enable ProGuard and/or Multi-Dex in project settings but none of them are working as I keep getting same error. I created a demo project and added only Urbanairship nuget package and it compiles and runs fine. Request form members to help me on this. (N.B.: I cannot remove any other nuget package from my project as all are being used)

Best Answer

  • krishnamvermakrishnamverma USMember ✭✭
    Accepted Answer

    @RajaRanganathan : It seems this issue is related with Multi-Dex. I updated ProGuard and then selected enable Multi-Dex and ProGuard from application properties. This solved this issue for me. Hope it works for you!

Answers

  • RajaRanganathanRajaRanganathan USMember ✭✭

    @krishnamverma : How did you resolve this issue? Can you please let us know.

  • krishnamvermakrishnamverma USMember ✭✭
    Accepted Answer

    @RajaRanganathan : It seems this issue is related with Multi-Dex. I updated ProGuard and then selected enable Multi-Dex and ProGuard from application properties. This solved this issue for me. Hope it works for you!

Sign In or Register to comment.