Error after Enable Multi-Dex in Xamarin Android

前端 未结 6 1774
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 04:54

While creating a Xamarin Android application, after adding the reference to Infragistics Chart control and the Google Play services, we had to enable the \'Enable Multi-Dex\' pr

相关标签:
6条回答
  • 2021-02-14 05:13

    I had the same problem. To resolve it you must go to the properties of your project and in the option Android Options in packaging you disable Multi-Dex. And in the debugger option choose Xamarin or not Microsoft. I think that it resolves your problem.

    0 讨论(0)
  • 2021-02-14 05:20

    For future reference, there is also a bug if you have JDK 1.8 installed..

    See this thread https://bugzilla.xamarin.com/show_bug.cgi?id=44013

    Unfortunately the actual bug is inaccessible to general public.. https://bugzilla.xamarin.com/show_bug.cgi?id=42669

    0 讨论(0)
  • 2021-02-14 05:28

    We had the same problem on our build server, and we've had to move the Android SDK to a path with no spaces e.g. C:\android-sdk\...

    Obviously we needed to update the ANDROID_HOME environment variable to the new path, and set the SDK paths in Xamarin Studio and Visual Studio.

    This has solved the problem for us.

    0 讨论(0)
  • 2021-02-14 05:31

    For those who don´t want to change the Android SDK actual location plus ANDROID_HOME env variable, a simple link is enough:

    mklink /D "C:\android-sdk" "C:\Program Files (x86)\Android\android-sdk"
    
    0 讨论(0)
  • 2021-02-14 05:33

    I'm facing this problem any time I make an update that change or install a new build-tools folder. So I decided to store the solution here for myself and for whom could benefit from this solution.

    Some of the bugzilla link in other solutions or comments are not accessible from anyone. The reason for this is an issue with the Android SDK on Windows machines. The following fix needs to be applied to the build server and developer machines:

    1. The fix is to adjust the mainDexClasses.bat in the Android SDK. Search for this file and apply the fix to all instances. The first thing is locate the folder android-sdk and sub build-tools. My path is for example C:\Users\YOURUSERNAME\AppData\Local\Android\android-sdk\build-tools\ check inside the folders named with the version number like xx.x.x (e.g. 24.0.1)
    2. So inside the mainDexClasses.bat file locate the following block of text:

    if DEFINED output goto redirect
    call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.MainDexListBuilder "%disableKeepAnnotated%" "%tmpJar%" "%params%"
    goto afterClassReferenceListBuilder
    :redirect call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.MainDexListBuilder "%disableKeepAnnotated%" "%tmpJar%" "%params%" 1>"%output%"
    :afterClassReferenceListBuilder

    And replace with:

    SET params=%params:'=%
    if DEFINED output goto redirect
    call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.MainDexListBuilder %disableKeepAnnotated% "%tmpJar%" %params%
    goto afterClassReferenceListBuilder
    :redirect call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.MainDexListBuilder %disableKeepAnnotated% "%tmpJar%" %params% 1>"%output%"
    :afterClassReferenceListBuilder

    1. Clean and build again.
    0 讨论(0)
  • 2021-02-14 05:33

    Please Put your SDK into where is available Enough space and then put your jar or dll file there it will worked.

    0 讨论(0)
提交回复
热议问题