【问题标题】:Android - app export errors with proguard and google play servicesAndroid - proguard 和 google play 服务的应用程序导出错误
【发布时间】:2014-09-23 13:11:50
【问题描述】:

我已将最新的 Google Play 服务添加到项目中,现在 proguard 正在提供 我有很多警告:

[2014-07-31 17:21:50 - MyApp] Proguard returned with error code 1. See console
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.common.SupportErrorDialogFragment: can't find referenced method 'void setShowsDialog(boolean)' in class com.google.android.gms.common.SupportErrorDialogFragment
[2014-07-31 17:21:50 - MyApp] Warning: com.google.android.gms.common.api.d: can't find referenced method 'android.support.v4.app.FragmentActivity getActivity()' in class com.google.android.gms.common.api.d
[2014-07-31 17:21:50 - MyApp]       You should check if you need to specify additional program jars.
[2014-07-31 17:21:50 - MyApp] Warning: there were 9 unresolved references to classes or interfaces.
[2014-07-31 17:21:50 - MyApp]          You may need to specify additional library jars (using '-libraryjars').
[2014-07-31 17:21:50 - MyApp] Warning: there were 2 unresolved references to program class members.
[2014-07-31 17:21:50 - MyApp]          Your input classes appear to be inconsistent.
[2014-07-31 17:21:50 - MyApp]          You may need to recompile them and try again.
[2014-07-31 17:21:50 - MyApp]          Alternatively, you may have to specify the option 
[2014-07-31 17:21:50 - MyApp]          '-dontskipnonpubliclibraryclassmembers'.
[2014-07-31 17:21:50 - MyApp] java.io.IOException: Please correct the above warnings first.
[2014-07-31 17:21:50 - MyApp]   at proguard.Initializer.execute(Initializer.java:321)
[2014-07-31 17:21:50 - MyApp]   at proguard.ProGuard.initialize(ProGuard.java:211)
[2014-07-31 17:21:50 - MyApp]   at proguard.ProGuard.execute(ProGuard.java:86)
[2014-07-31 17:21:50 - MyApp]   at proguard.ProGuard.main(ProGuard.java:492)

我已经尝试添加

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

到 proguard 配置文件,但没有运气。我在我的应用程序中定位到 android 17 (4.2.2),并且最低 SDK 版本是 8(我认为是 2.2)。

任何解决此错误的帮助将不胜感激。

【问题讨论】:

    标签: android google-play-services proguard


    【解决方案1】:

    确保您已使用 Android 4.4.2 设置您的项目并且您已“包含 android-support-v13.jar”。我有同样的问题,但现在已经解决了。

    【讨论】:

      【解决方案2】:

      你添加了吗:

      -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 中? http://developer.android.com/google/play-services/setup.html

      【讨论】:

      • 是的,我已经添加并完成了添加google play服务的所有步骤。
      【解决方案3】:

      似乎 google play 服务 jar 引用了 android-support-v13.jar 中的一些类。 因此在 proguard-project.txt 中添加以下行将解决问题:

      -libraryjars <ANDROID_SDK_PATH>/extras/android/support/v13/android-support-v13.jar
      

      您需要使用 Android SDK 管理器下载此 jar。

      【讨论】:

        猜你喜欢
        • 2016-11-01
        • 2014-08-11
        • 2015-01-23
        • 2014-02-05
        • 2013-07-09
        • 1970-01-01
        • 2013-05-31
        • 2014-06-21
        • 2015-11-27
        相关资源
        最近更新 更多