Forum Xamarin.Forms

java.exe exited with code 2

JassimRahmaJassimRahma USMember ✭✭✭✭


I am getting:

"java.exe" exited with code 2

after adding the AdMob Nugets

I enabled Multi-Dex but still getting the same error.

I have also added:


In my AndroidManifest.xml

The details log as per the attached shows: Too many classes in --main-dex-list, main dex capacity exceeded

How can I fix this please?



  • jezhjezh Member, Xamarin Team Xamurai

    You could try the following steps first:
    1. Close Project
    2. Delete bin and obj folders from PCL/Shared Project and all other platforms including Android
    3. Open project
    4. Rebuild

    If the error still exist, you can try to create a new project and copy the old project's code, resources, and packages to the new one.

  • JassimRahmaJassimRahma USMember ✭✭✭✭
    I did all this already and it did not work so I had to get rid of the firebase ads packages temporary and will try it later..

    Removing the firebase ads packages fixed the problems
  • Isha_DawarIsha_Dawar INMember ✭✭
    edited May 2019

    @JassimRahma Try enabling Multi-Dex option under project Settings without removing firebase packages.

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    It was enabled.

  • VovaKamishnikovVovaKamishnikov USMember ✭✭✭
    edited May 2019

    I had that issue when I don't install a nuget in ALL project but only in some of them.
    Do you install any new nuget in the solution?

  • VovaKamishnikovVovaKamishnikov USMember ✭✭✭

    @JassimRahma said:
    It was enabled.

    It seems like dex isn't enbaled : Too many classes in --main-dex-list, main dex capacity exceeded

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    Again I am having it but this now I didn't do anything nor new updates. It just occurs :'(

    I am unable to figure out where is the issue.

    I posted here with the log and screenshots to avoid multiple same post:

Sign In or Register to comment.