如何使用ProGuard混淆android应用程序

时间:2015-02-20 21:23:51

标签: android proguard

我看了this link,我的应用程序使用谷歌播放服务。我添加了这行

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

但是当我导出我的应用程序时会出现此错误:

[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Proguard returned with error code 1. See console
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.fitness.service.FitnessSensorService$a: can't find referenced class android.app.AppOpsManager
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.fitness.service.FitnessSensorService$a: can't find referenced class android.app.AppOpsManager
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.internal.af: can't find referenced method 'boolean isAttachedToWindow()' in class android.view.View
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.internal.an$2: can't find referenced method 'void evaluateJavascript(java.lang.String,android.webkit.ValueCallback)' in class android.webkit.WebView
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: com.google.android.gms.internal.gu: can't find referenced method 'void evaluateJavascript(java.lang.String,android.webkit.ValueCallback)' in class android.webkit.WebView
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]       You should check if you need to specify additional program jars.
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: there were 11 unresolved references to classes or interfaces.
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]          You may need to specify additional library jars (using '-libraryjars').
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] Warning: there were 3 unresolved references to program class members.
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]          Your input classes appear to be inconsistent.
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]          You may need to recompile them and try again.
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]          Alternatively, you may have to specify the option 
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]          '-dontskipnonpubliclibraryclassmembers'.
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari] java.io.IOException: Please correct the above warnings first.
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]     at proguard.Initializer.execute(Initializer.java:321)
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]     at proguard.ProGuard.initialize(ProGuard.java:211)
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]     at proguard.ProGuard.execute(ProGuard.java:86)
[2015-02-20 23:15:04 - TurkiyeYollarindaTrafikOlaylari]     at proguard.ProGuard.main(ProGuard.java:492)

我是使用proguard的新手。我将发布我的第一个Android应用程序。我不明白这些错误所以有任何帮助吗?

1 个答案:

答案 0 :(得分:0)

您可能正在使用' -libraryjars'在项目中使用第3方库而忘记包含在proguard.config中。标签...?