删除日志呼叫使用的ProGuard [英] Removing Log call using proguard

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

问题描述

我想用ProGuard的剥夺我所有的日志: 我已经进入下面一行在我的ProGuard-project.txt:

  -assumenosideeffects类android.util.Log {*; }
 

和我的project.properties是这样的:

  proguard.config = $ {sdk.dir} /tool​​s/proguard/proguard-android.txt:proguard-project.txt
 

这在日志继续在我的应用程序,以显示Inspite。究竟是什么我做错了什么?

解决方案

您应该不指定*通配符,因为它包括类似方法'对象#等待()。更好地明确列出的方法:

  -assumenosideeffects类android.util.Log {
    公共静态布尔isLoggable(java.lang.String中,INT);
    公共静态INT V(...);
    公共静态INT I(...);
    公共静态INT W(...);
    公共静态INT D(...);
    公共静态INT E(...);
}
 

如果优化未禁用,像此选项仅与ProGuard的-android.txt 。你必须指定 ProGuard的-Android的optimize.txt 来代替:

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

I am trying to use proguard to strip all my logs: I have entered the following line in my proguard-project.txt:

-assumenosideeffects class android.util.Log { *; }

And my project.properties looks like this:

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

Inspite of this the logs continue to show in my application. What exactly am I doing wrong here?

解决方案

You shouldn't specify the '*' wildcard, because that includes methods like 'Object#wait()'. Better explicitly list the methods:

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

This option is only relevant if optimization is not disabled, like in proguard-android.txt. You have to specify proguard-android-optimize.txt instead:

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

这篇关于删除日志呼叫使用的ProGuard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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