redth-org / AndHUD

Android Progress HUD and Dialog helpers for Xamarin.Android apps!
Apache License 2.0
180 stars 69 forks source link

java error code 2 #42

Closed matt2003 closed 5 years ago

matt2003 commented 5 years ago

Hi, I cannot get andhud to compile in with either the nuget or the project from github. I am using android.support v28, tried 1.41 and 1.2. Clean build remove bin and obj etc. And help would be appreciated.

I also set to multidex enabled through project options, tried the proguard / enable disable.

Thanks, Matt Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error MSB6006: "java" exited with code 2.

Cheesebaron commented 5 years ago

Can you please provide more information or a small repro sample where I can see this issue?

The full error message with stack would help

matt2003 commented 5 years ago

I get the the error on compilation so no stack trace here is the output with multidex on UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded at com.android.dx.command.dexer.Main.processAllFiles(Main.java:548) at com.android.dx.command.dexer.Main.runMultiDex(Main.java:368) at com.android.dx.command.dexer.Main.runDx(Main.java:289) at com.android.dx.command.dexer.Main.main(Main.java:247) at com.android.dx.command.Main.main(Main.java:94)

I had also updated proguard from the site and its supporting files

I even tried the D8/ R8 solution which made some other issue so I removed it

https://stackoverflow.com/questions/55818155/multidex-main-dex-capacity-exceeded-with-multidex-enabled

Using the MS OpenJDK

matt2003 commented 5 years ago

I found a workaround here https://github.com/xamarin/xamarin-android/issues/2919 As the nice gentleman mentions in the other post adding this to the projectgroup in the csproj file works. Apparently this is the equivalent setting that could be passed to gradle had we been doing it the native way. DxExtraArguments>--dex --no-strict --force-jumbo AndroidMultiDexClassListExtraArgs>--disable-annotation-resolution-workaround</AndroidMultiDexClassListExtraArgs

this was using vs 2017 for mac

for vs 2019 for mac there is another solution with r8 and desugar but not d8 for some reason additionally I had to remove the BOM in the proguard.cfg file using HexFiend on mac

did manage to compile now with vs 2019 for mac using in both debug and release mode with and without proguard and without multidex only multipledex

AndroidEnableDesugar>true</AndroidEnableDesugar AndroidDexTool>d8</AndroidDexTool

Though r8 cant be found on the path it believes it to be. Its actual location is /Library/Frameworks/Xamarin.Android.framework/Versions/9.2.0-5/lib/xamarin.android/xbuild/Xamarin/Android/r8.jar It believes it to be here !Exists('/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/r8.jar'

It is compiling which is great

Cheesebaron commented 5 years ago

@matt2003 thanks for the clarification!