trouble writing output: Too many field references: 69636; max is 65536. (TaskId:320) 2

Hi , I am developing a cross platform app using Xamarin native app. While trying to add the Azure Messaging Component, I am getting error saying

-- trouble writing output: Too many field references: 69636; max is 65536. (TaskId:320)
2> You may try using --multi-dex option. (TaskId:320)

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2068,3): error MSB6006: "java.exe" exited with code 2.

if I am tying to enable the --multi-dex option in properties my app not deploying into the mobile.

Can any one please help me.

Tagged:

Posts

  • vyshnaviekshithavyshnaviekshitha USMember

    yes, im also facing same problem when i added more packages / components or references and then im unable to build my project its showing same error C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2068,3): error MSB6006: "java.exe" exited with code 2.
    "java.exe" exited with code 2." --- unable to solve this error did'nt find any solution
    can any one help me...?

  • PiotrZyskowskiPiotrZyskowski PLMember

    Confirm above.
    Spent few hours to make build pass... till I saw your post.

    In my case there wasn't AndroidEnableMultiDex option just that first option was. I just had to add it to csproj and voila:)

    It also gets work on Mobile Center and auto builds.

    Thanks.

  • JoeDluzenJoeDluzen USBeta ✭✭

    Can also confirm, this was the fix for me as well.

  • KiranMandavaKiranMandava INMember

    Thank u so much. My Issue is solved with your advice.

  • rdeveenrdeveen USMember
    edited June 2017

    When adding the second AndroidEnableMultiDex I get this extra error:

    error : Expecting class path separator ';' before '\Android\android-sdk\build-tools\25.0.2\lib\shrinkedAndroid.jar' in argument number 8

    But that looks like a VS2017 Preview bug :( but it work on VS2017.

  • pratik90pratik90 INMember ✭✭

    @diegoxleon Thanks, I also confirm that change is working and now can able to create build using vsts

  • DevologyDevology GBMember ✭✭
    edited February 15

    Setting the multi-dex option worked for me too, thanks. It's worth highlighting that you can set this for debug and release and in release you might not need to if you have used ProGuard (it might bring you under the limit anyway).

  • EdwinKlesmanEdwinKlesman USMember ✭✭

    For me, I toggled the Enable Multidex checkbox for debug, then switched configurations to release and did the same.
    In the project structure, it appears that only for the debug configuration this was added. Only one line said:

    <AndroidEnableMultiDex>true</AndroidEnableMultiDex>
    

    Whereas this should've been added to the Release configuration in the myproject.Droid.csproj file as well.

    Thanks for guiding me into this direction.

    @diegoxleon said:
    There is a bug with Visual Studio and multi-dex option in the android project properties. When you tick "Enable Multi-Dex" option, you´ll see the change reflected in the csproj as you would expect:

    <AndroidEnableMultipleDex>true</AndroidEnableMultipleDex>
    

    But if you take a closer look, there is another similar xml node that keeps its value to false:

    <AndroidEnableMultiDex>false</AndroidEnableMultiDex>
    

    Notice the difference between "MultiDex" and "MultipleDex"

    Changing the second one to true will make the trick.

    Just in case, I´m using VS 15.2

Sign In or Register to comment.