Android release版关闭日志logcat
2015-09-24 17:28
615 查看
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中使用的本程序其他的方法不跑。
相关文章推荐
- android:layout_weight的真实含义
- Android学习笔记之AndroidManifest.xml文件解析
- Android strings.xml技巧
- Android自定义ListView,轻松实现上下拉刷新,一看就懂,一学就会,超简单。
- 【转】Android 向右滑动销毁(finish)Activity, 随着手势的滑动而滑动的效果
- Android学习笔记:通过Android之Service实现文件断点续传下载
- Android基础入门教程——2.4.11 AutoCompleteTextView(自动完成文本框)的基本使用
- Android软件开发之 自定义别样Toast
- Android 4.0日历(calendar)源码分析之月视图
- Android之webview与js交互
- Android 悬浮并可拖动的实现
- 最清晰的Android多屏幕适配方案
- Android版本支付宝集成获取私钥与公钥
- Android中如何自己定义Toast
- android应用程序如何调用支付宝接口
- android应用程序如何调用支付宝接口
- android开发之自定义AutoCompleteTextView
- android开发之自定义AutoCompleteTextView
- android开发之自定义AutoCompleteTextView
- android开发之自定义AutoCompleteTextView