4
我想在發佈時從日誌中清除我的項目。 但我嘗試使用ProGuard,並將具有零結果: 我的項目設置:Proguard不會刪除我的日誌
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19
android.library.reference.1=..\\google-play-services_lib
而且我proguard相關的屬性
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-keepattributes LineNumberTable
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
#To remove debug logs:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** w(...);
public static *** i(...);
}
-keep class android.support.v4.** { *; }
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Fragment
-keep public class * extends android.app.ListActivity
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembers class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class net.hockeyapp.android.UpdateFragment {
*;
}
-keepclassmembers class * {
public void onClickUpdate(android.view.View);
}
-keep public class javax.net.ssl.**
-keepclassmembers public class javax.net.ssl.** {
*;
}
-keep public class org.apache.http.**
-keepclassmembers public class org.apache.http.** {
*;
}
爲什麼它不工作?我試圖關閉/開啓optimization..same結果
謝謝,這就是我需要! – onCreate
雖然有一些風險。查看評論按照https://android.googlesource.com/platform/sdk/+/master/files/proguard-android-optimize.txt – Elye
還有其他的方法來刪除調試信息,你可以在https中找到它://medium.com/@elye.project/debug-messages-your-responsible-to-clear-it-before-release-1a0f872d66f#.6io15cj29 – Elye