簡體   English   中英

Android-Proguard和Google Play服務的應用導出錯誤

[英]Android - app export errors with proguard and google play services

我已將最新的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 4.4.2設置項目,並且具有“ include android- support-v13.jar”。 我有同樣的問題,但現在已解決。

您是否添加了:

-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服務jar正在引用android-support-v13.jar中的某些類。 因此,在proguard-project.txt中添加以下行將解決該問題:

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM