android - Google Play 服务 v23 Proguard 配置

标签 android google-play-services proguard

升级到 Google Play 服务 v23 后,我在 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)

我按照 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;
}

并尝试添加

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

proguard-project.txt,但这没有帮助。

我错过了什么?

最佳答案

嘿,我有完全相同的错误,我通过添加修复它:

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

到我的 proguard.cfg

关于android - Google Play 服务 v23 Proguard 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29715460/

相关文章:

android - 谷歌播放服务 sdk : Requesting for offline access during auth

android - 未出现 Google Play 服务 "Connecting"弹出窗口

android - 签名应用程序期间库中的警告

android - 使用ArcGIS android SDK的离线 map

android - java.lang.NoClassDefFoundError : com. google.android.gms.gcm.GoogleCloudMessaging 安卓

java - 签署 Android 应用程序时出现 Proguard 错误/Dalvik 错误 1

Proguard 找不到基本包和父类(super class)

android - 将 flutter Painter 转换为 compose

java - 多个 EditText 框的 textChanged 方法

android - 如何使用编程在android中禁用系统通知