ProGuard的:找不到引用的类com.google.android.gms.R [英] ProGuard: can't find referenced class com.google.android.gms.R
问题描述
在在Android SDK中的经理有些更新我尽量使签署的apk,并得到这样的:
After some updates in Android SDK manager I try make signed apk and get this:
ProGuard: [] Warning: com.google.android.gms.auth.GoogleAuthUtil:
can't find referenced class com.google.android.gms.R
ProGuard: [] Warning: com.google.android.gms.auth.GoogleAuthUtil:
can't find referenced class com.google.android.gms.R$string
...
etc.
如果设置 -dontwarn com.google.android.gms。**
编译就可以了。但运行后,我得到的错误这样的很多报道(许多设备):
If set -dontwarn com.google.android.gms.**
compiling is OK. But after run I get error many reports like this (from many devices):
Caused by: android.view.InflateException: Binary XML file line #32:
Error inflating class com.google.android.gms.common.SignInButton
在我的设备一切ok。更新前我还没有ProGuard的警告和所有的工作完美。它是如何解决?
On my devices all ok. Before update I have not ProGuard warnings and all work perfectly. How it fix?
推荐答案
虽然将其加入 ProGuard的-project.txt
文件的作品,它让所有的类。
Although adding this to proguard-project.txt
file works, it keeps all classes.
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
我$ P PFER这个$,这使得apk文件大小小很多:
I prefer this, which makes apk file size much smaller:
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
另外请注意最新的谷歌播放Proguard的通知在这里:<一href="http://developer.android.com/google/play-services/setup.html#Proguard">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;
}
这篇关于ProGuard的:找不到引用的类com.google.android.gms.R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!