Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Play Services v23 Proguard configuration

After upgrading to Google Play services v23, I see this message when trying to export signed application in Eclipse:

Proguard returned with error code 1. See console
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller$SessionInfo
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller$SessionInfo
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced method 'android.content.pm.PackageInstaller getPackageInstaller()' in class android.content.pm.PackageManager
Warning: com.google.android.gms.internal.zzif: can't find referenced method 'void setMixedContentMode(int)' in class android.webkit.WebSettings
      You should check if you need to specify additional program jars.
Warning: there were 4 unresolved references to classes or interfaces.
         You may need to specify additional library jars (using '-libraryjars').
Warning: there were 2 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile them and try again.
         Alternatively, you may have to specify the option 
         '-dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:321)
    at proguard.ProGuard.initialize(ProGuard.java:211)
    at proguard.ProGuard.execute(ProGuard.java:86)
    at proguard.ProGuard.main(ProGuard.java:492)

I added this, as specified in documentation

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

and tried adding

-keep class android.content.pm.PackageInstaller.**

to proguard-project.txt, but this didnt help.

What am I missing?

like image 376
A.G. Avatar asked Apr 18 '15 09:04

A.G.


Video Answer


2 Answers

I fixed it by adding this to proguard-project.txt:

-keep class android.content.pm.PackageInstaller
-keep class android.content.pm.PackageInstaller$SessionInfo
-keep class android.content.pm.PackageManager

-dontwarn android.content.pm.PackageInstaller
-dontwarn android.content.pm.PackageInstaller$SessionInfo
-dontwarn android.content.pm.PackageManager

-keep class android.webkit.WebSettings
-dontwarn android.webkit.WebSettings
like image 98
A.G. Avatar answered Sep 19 '22 21:09

A.G.


hey i had the exact same error i fixed it by adding :

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

to my proguard.cfg

like image 20
Lary Ciminera Avatar answered Sep 20 '22 21:09

Lary Ciminera