Java.exe completed with code 2 (MSB6006) Error output: Too many field references: 81626; max - 65536

I am developing an xamarin android application and it uses a lot of packages and links (Google Play services). When I try to build this project, I get this error:

java.exe completed with code 2 Error writing errors: too many link fields: 81626; max - 65536. You can try using --multi-dex Option

.

+4
source share
3 answers

You need to include Mutlidexin your project. Xamarin.Android supports this since version 5.1 :

Multi-Dex $(AndroidEnableMultiDex) MSBuild, Visual Studio Xamarin Studio.

+1

multidex, Samsung S5, S6, So on. . , , Samsung .

multi-dex .

-1

gradle:

defaultConfig {

    applicationId 'pkg'
    minSdkVersion 
    targetSdkVersion 
    versionCode 
    versionName 

    // Enable MultiDexing:  https://developer.android.com/tools/building/multidex.html
    multiDexEnabled true
}

:

  compile 'com.android.support:multidex:1.0.1'

..!!

-2

Source: https://habr.com/ru/post/1611722/


All Articles