Android release版关闭日志logcat

Android release版关闭日志logcat

assumenosideeffects

    assumenosideeffects,proguard 配置文件里的参数。assume no side effects;假定无效;该属性也就是标识无效代码。我们就是通过这个参数来让proguard删除日志代码。

   assumenosideeffects的官方解释:

  In the optimization step, ProGuard will then remove calls to such methods, if it can determine that the return values aren't used.ProGuard will analyze your program code to find such methods automatically.It will not analyze library code, for which this option can therefore be useful.
           In general, making assumptions can be dangerous; you can easily break the processed code. Only use this option if you know what you're doing!

       如下:

#-dontoptimize     

 -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(...);
       }

   使用这个配置时,一定要注意,配置。

    don‘t optimize 不要优化;将会关闭优化,导致日志语句不会被优化掉。所以不能有这个配置。

关键是:它不会把logcat中的方法过滤掉,即不用担心logcat中使用的本程序其他的方法不跑。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值