我想配置ProGuard,並將面臨與按優先級排序的一些問題:安卓:配置Proguard的
我收到重複的警告,拉鍊,不能修復它。 我在「libs」目錄和2個庫項目中使用外部庫(一個庫項目有一個外部庫 - 只添加到項目一次),這些項目只添加到項目一次。我試圖將我的外部罐子移動到另一個目錄,即「lib」 - 只是因爲一些用戶已經設法解決它而重命名,但它不能幫助我。另一種方法是試圖實現custom_rules到基本的build.xml,因爲它可以幫助一些用戶避免這些警告。但是它的一切都不能幫助我,我該如何解決它?登錄:
ProGuard: Note: com.google.analytics.tracking.android.AdHitIdGenerator: can't find dynamically referenced class com.google.ads.AdRequest ProGuard: Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService' ProGuard: Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
完全proguard的文件:
ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jackson-annotations-2.1.4.jar:META-INF/MANIFEST.MF])
ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [android-support-v4.jar:META-INF/MANIFEST.MF])
ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [google-analytics-v2.jar:META-INF/MANIFEST.MF])
ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jackson-core-2.1.4.jar:META-INF/MANIFEST.MF])
ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [httpclientandroidlib-1.1.2.jar:META-INF/MANIFEST.MF])
ProGuard: Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [deviceprint-lib-1.0.0.jar:META-INF/MANIFEST.MF])
最後一件事簽署APK建設過程中的一些注意事項
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
# Otherwise return Warning: com.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
-dontwarn com.fasterxml.jackson.databind.**
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
# Preserve all fundamental application classes.
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.view.View
-keep public class * extends android.preference.Preference
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
# Preserve ActionBarSherlock and Android support libraries` classes and interfaces
-keep class android.support.** { *; }
-keep interface android.support.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
# Preserve all Jackson library classes
-keep class com.fasterxml.jackson.** { *; }
# Original
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
#To remove debug logs:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
}
我希望這些警告和說明是真正無害的。一般來說,儘管有這些消息,但該應用似乎仍能正常工作。至於其他你的建議,我現在就和你說的一樣 - 最後一個Android SDK,從IDEA構建簽名的apk(沒有嘗試從命令行運行Ant來構建Ant),刪除所有由於它而產生的傷害,outjats,libjars會導致出現更多重複記錄,請使用-keep來包裝未受影響的類 – user1376885 2013-05-09 10:51:00