为什么 proguard 处理 AndroidManifest.xml [英] Why proguard processes AndroidManifest.xml

查看:39
本文介绍了为什么 proguard 处理 AndroidManifest.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了一些无法解释的 Proguard 行为.

I see some unexplained Proguard behaviour.

AFAIK proguard 不关注 android manifest.另外,在我的 proguard.cfg 中,我没有提到与 BroadcastReceiver 相关的类.所以我认为这些应该被删除.

AFAIK proguard does not pay attention to android manifest. Also, in my proguard.cfg I have no mention of BroadcastReceiver related classes. So I assume that those should be stripped out.

但是我在 bin/proguard.txt 中看到了一些奇怪的东西:

However I see something strange in bin/proguard.txt:

# view AndroidManifest.xml #generated:784
-keep class com.fiksu.asotracking.InstallTracking { <init>(...); }

并且该类(BroadcastReceiver 的后代)不会被剥离.理性对我来说没有任何意义:

and that class (descendand of BroadcastReceiver) does not get stripped. Reason does not say anything meaningful to me:

[proguard] com.fiksu.asotracking.InstallTracking
[proguard]   is kept by a directive in the configuration.

如果清单中没有提到类,它就会被剥离.

If class is not mentioned in manifest, it gets stripped.

很高兴知道为什么.

推荐答案

构建过程运行工具aapt自动创建配置文件bin/proguard.txt,基于 AndroidManifest.xml 和其他 xml 文件.然后构建过程将配置文件传递给 ProGuard.所以ProGuard本身确实不考虑AndroidManifest.xml,而是aapt+ProGuard.

The build process runs the tool aapt to automatically create the configuration file bin/proguard.txt, based on AndroidManifest.xml and other xml files. The build process then passes the configuration file to ProGuard. So ProGuard itself indeed doesn't consider AndroidManifest.xml, but aapt+ProGuard do.

这篇关于为什么 proguard 处理 AndroidManifest.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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