ProGuard: can't find referenced class com.google.android.gms.R ProGuard: can't find referenced class com.google.android.gms.R android android

ProGuard: can't find referenced class com.google.android.gms.R


Although adding this to proguard-project.txt file works, it keeps all classes.

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

I prefer this, which makes apk file size much smaller:

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

Also note up to date Google Play Proguard notification here: http://developer.android.com/google/play-services/setup.html#Proguard

-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;}


You need to ignore like you are compiling but you also need to keep the class so it can find it during runtime.

Add these two lines to your proguard configuration file:

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


I came across a similar issue and eventually discovered that I had updated the Google Play Services module however I hadn't re-added the module to my main module in Android Studio. Adding that back in resolved my issues.