【问题标题】:Proguard fails with Google Play Services libraryProguard 因 Google Play 服务库而失败
【发布时间】:2014-07-02 02:04:23
【问题描述】:

更新Google Play Services 库后,我无法在启用Proguard 的情况下构建我的包。我的项目minSdkVersion9。我正在使用以下版本的服务库:

android:versionCode="4323030"
android:versionName="4.3.23 (1069729-030)" >

图书馆声明minSdk 也是9

得到错误:

Unexpected error while performing partial evaluation:
Class       = [com/google/android/gms/common/GooglePlayServicesUtil]
Method      = [showErrorDialogFragment(ILandroid/app/Activity;ILandroid/content/DialogInterface$OnCancelListener;)Z]
Exception   = [java.lang.IllegalArgumentException] (Can't find any super classes of [com/google/android/gms/common/ErrorDialogFragment] (not even immediate super class [android/app/DialogFragment]))
java.lang.IllegalArgumentException: Can't find any super classes of [com/google/android/gms/common/ErrorDialogFragment] (not even immediate super class [android/app/DialogFragment])

在我的 proguard 文件中可以找到以下与 gms 相关的内容:

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

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

DialogFragment 是在 API 级别 11 中添加的。这是服务库的故障还是我遗漏了什么?

谢谢。

【问题讨论】:

    标签: android proguard google-play-services


    【解决方案1】:

    您应该针对包含缺失类的 API 级别 11 进行构建。库本身可能对旧 API 有回退模式,但 ProGuard 仍需要处理整个应用程序,包括新代码。

    【讨论】:

    • 为了快速解决问题,我使用了较旧的地图库,但很可能这是可行的,我只需要正确处理所有即将到来的弃用和 API 更改。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-11
    • 2014-09-05
    • 2013-05-01
    • 1970-01-01
    • 2014-04-09
    • 2017-05-18
    • 2020-04-09
    相关资源
    最近更新 更多