Reputation:
I have tried out a lot of solutions on how to get this resolved. My debug works alright. But as at now, i am trying to build archive my apk in the release mode. When i re-build in the release mode i get the error Java exited with code 1 (MSB6006)
.
Proguard and multi-dex is enabled in my Droid project. My heap size is also set already to 1G. I also created a proguard.cfg file in my Droid project but i still get the same error. When i check the error reference, it leads to me this in my browser MSBuild.ToolTask.ToolCommandFailed
.
Is there any other i could solve this ?
Attached is the https://gist.github.com/anonymous/9e7fba8cc745ce9ae06fa2c8ae075697 - Full Diagnostic Build Output.
proguard.cfg
# This is Xamarin-specific (and enhanced) configuration.
-dontobfuscate
-keep class mono.MonoRuntimeProvider { *; <init>(...); }
-keep class mono.MonoPackageManager { *; <init>(...); }
-keep class mono.MonoPackageManager_Resources { *; <init>(...); }
-keep class mono.android.** { *; <init>(...); }
-keep class mono.java.** { *; <init>(...); }
-keep class mono.javax.** { *; <init>(...); }
-keep class opentk.platform.android.AndroidGameView { *; <init>(...); }
-keep class opentk.GameViewBase { *; <init>(...); }
-keep class opentk_1_0.platform.android.AndroidGameView { *; <init>(...); }
-keep class opentk_1_0.GameViewBase { *; <init>(...); }
-keep class android.runtime.** { <init>(***); }
-keep class assembly_mono_android.android.runtime.** { <init>(***); }
# hash for android.runtime and assembly_mono_android.android.runtime.
-keep class md52ce486a14f4bcd95899665e9d932190b.** { *; <init>(...); }
-keepclassmembers class md52ce486a14f4bcd95899665e9d932190b.** { *; <init>(...); }
# Android's template misses fluent setters...
-keepclassmembers class * extends android.view.View {
*** set*(***);
}
# also misses those inflated custom layout stuff from xml...
-keepclassmembers class * extends android.view.View {
<init>(android.content.Context,android.util.AttributeSet);
<init>(android.content.Context,android.util.AttributeSet,int);
}
Upvotes: 0
Views: 2863
Reputation: 589
ProGuard and MultiDex on Xamarin.Android need a little extra work.
Related to ProGuard, it may be removing some Java classes from your APK and causing bugs. You need to create a proguard.cfg file and set its Build Action to ProguardConfiguration. By the way, it is not necessary to set the Heap size to 1G.
Related to MultiDex, you also need to create a MultiDexApplication class that extends Application.
If you are using the Android SDK for Windows, you need to update proguard.jar to its latest version and also change mainClassesDex.bat.
Upvotes: 1
Reputation: 1481
Turn on MultiDex
RightClick on Xamarin.Android--->Goto Properties-->AndroidOptions-->Now Enable MultiDex
Now Clean and Rebuild your solution
We had similar issues and nailed it down to our app going over 65k methods limit (which could be what's happening when you reference google play services).
https://developer.android.com/studio/build/multidex.html
The below link useful for you
Upvotes: 5