0
votes

I receive this error when I try to rebuild app with proguard: (I tried all the solutions suggested for the error MSB6006: "java.exe" exited with code 1, but in my case, it seems have some conflicts with GCM )

19>PROGUARD : warning : com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in class android.app.Notification 19>PROGUARD : warning : com.google.android.gms.gcm.zza: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in class android.app.Notification 19> You should check if you need to specify additional program jars. 19>PROGUARD : warning : there were 2 unresolved references to program class members. 19>
Your input classes appear to be inconsistent. 19> You may need to recompile them and try again. 19> Alternatively, you may have to specify the option 19>
'-dontskipnonpubliclibraryclassmembers'. 19> java.io.IOException: Please correct the above warnings first. 19> at proguard.Initializer.execute(Initializer.java:321) 19> at proguard.ProGuard.initialize(ProGuard.java:211) 19> at proguard.ProGuard.execute(ProGuard.java:86) 19> at proguard.ProGuard.main(ProGuard.java:492) 19> Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 19>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2118,3): error MSB6006: "java.exe" exited with code 1.

2
I use Proguard (in Xamarin.Android projects) wth GCM and do not have a problem. I would assume it is the use of setLatestEventInfo in the error you posted as that is an older/deprecated method (assuming you are using it and targeting older APIs). The answer that was posted should help. - SushiHangover

2 Answers

2
votes

The Google GMS libraries sometimes try to access library methods that are not available for a given target SDK version and gracefully handle errors at runtime. So it is usually required and safe to add something like this to ignore such warnings:

-dontwarn com.google.android.gms.**
-dontnote com.google.android.gms.**

These rules will ignore all warnings and notes from the gms libraries.

0
votes

I solved it with this solution from Xamarin forum:

Create file named proguard.cfg inside Android project in the solution. Right click and set Build Action to ProguardConfig. Add the following lines:

-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**

Amend the above according to type of errors you're getting Make sure you save file as UTF-8 and NOT UTF-8 BOM

Compile version: 6.0 Min target: 5.1 Target version: 6.0