Proguard不会删除我的日志 [英] Proguard does not remove my logs

查看:145
本文介绍了Proguard不会删除我的日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发布时,我想从日志中清除我的项目. 但是我正在尝试使用proguard且结果为零: 我的项目设置:

I want to clear my project from logs, when releasing. But i'm trying to use proguard and have zero result: my project settings :

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属性

And my proguard-properties

   -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.** {
  *;
}

为什么它不起作用?我正在尝试关闭/打开优化..相同的结果

Why its not work? I'm trying to turn off/on optimization..same result

推荐答案

如果要使assumenosideeffects设置起作用,则必须使用proguard-android-optimize.txt:

You have to use proguard-android-optimize.txt, if you want the assumenosideeffects settings to work:

将您的proguard.config行更改为:

Change your proguard.config line to:

proguard.config = $ {sdk.dir}/tools/proguard/proguard-android- 优化 .txt:proguard-project.txt

proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt

可以在 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆