proguard.cfg 无法在使用 LIBRARY 的导出应用程序中工作
我有同一应用程序的两个版本,使用相同的 proguard.cfg
,以下部分旨在压制所有 Log.x() LogCat 输出:
-assumenosideeffects class android.util.Log {
public static *** v(...);
public static *** i(...);
public static *** d(...);
public static *** w(...);
public static *** e(...);
}
第一个版本是整体的(即不引用任何库项目)并且 proguard.cfg 完全按照预期工作。
第二个版本使用两个库项目(一个是我的,另一个是 Google 的 LVL)。相同的 proguard.cfg
被放置在应用程序项目和我的库项目中。然而,在第二个版本中,proguard.cfg
似乎根本没有效果!
什么可以解释这一点?
I have two versions of the same application using identical proguard.cfg
with the following section aimed at squelching all Log.x() LogCat output:
-assumenosideeffects class android.util.Log {
public static *** v(...);
public static *** i(...);
public static *** d(...);
public static *** w(...);
public static *** e(...);
}
The first version is monolithic (i.e. not referencing any Library projects whatsoever) and proguard.cfg
works there exactly as expected.
The second version is using two Library projects (one is mine and the other is Google's LVL). The same proguard.cfg
is placed in both the application project and my Library project. However, in that second version, proguard.cfg
seems to simply have no effect!
What could possibly explain this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否将
proguard.config=proguard.cfg
添加到应用程序项目中的build.properties
中?您应该看到 ProGuard 的控制台消息和输出文件。优化过程至少应该提到一些“删除指令的数量”。应用程序类和库类都编译为 bin/classes。然后对它们进行完全相同的处理:将它们合并到 bin/original.jar 中,并使用 proguard.cfg 混淆为 bin/obfuscated.jar。添加更多的类并不能真正对删除日志记录代码产生影响。
You did add
proguard.config=proguard.cfg
tobuild.properties
in your application project? You should see ProGuard's console messages and output files. The optimization pass should at least mention some "Number of removed instructions".The application classes and the library classes are all compiled to bin/classes. They are then treated exactly the same: they are combined into bin/original.jar and obfuscated to bin/obfuscated.jar, using proguard.cfg. Adding more classes can't really have an effect on removing the logging code.
请使用此开关进行诊断:
-whyareyoukeeping
Please use this switch to diagnose:
-whyareyoukeeping
要禁用我的应用程序中的日志记录,我使用了以下方法:
如果这不能解决您的问题,那么还有其他一些方法可以尝试:
元素设置为android:debuggable="false"
To disable logging in my app, I used this:
If that doesn't solve your problem then there are a couple other things to try:
<application>
element is set toandroid:debuggable="false"