如何去掉android log代碼

強力去除log, 刪除log代碼,能夠用Proguard的優化來作。 配置以下html


-optimizations code/removal/advanced
-optimizationpasses 5java

#去掉log4j的log:android

-assumenosideeffects class * implements org.slf4j.Logger {
    public *** trace(...);
    public *** debug(...);
    public *** info(...);
    public *** warn(...);
    public *** error(...);
}ide

#去掉android原生log:優化

-assumenosideeffects class android.util.Log {
    public static boolean isLoggable(java.lang.String, int);
    public static int v(...);
    public static int i(...);
    public static int w(...);
    public static int d(...);
    public static int e(...);
}.net

參考文檔:debug


 http://proguard.sourceforge.net/manual/usage.html#optimizationoptions
 http://proguard.sourceforge.net/manual/examples.html#logging
 http://proguard.sourceforge.net/index.html#/manual/optimizations.htmlcode

相關文章
相關標籤/搜索