我一直在使用android构建系统做很多工作,我遇到了一个情况,即proguard正在删除导致NoClassDefFoundError的必需类。我可以告诉班级没有找到,但是我花了一段时间才发现proguard弄乱了用我的代码构建的类。
我终于发现我可以通过将LOCAL_PROGUARD_ENABLED := disabled
添加到Android.mk文件来阻止proguard的运行。
我之所以能做到这一点,是因为我偶然遇到了一些同样的Android.mk文件。
我无法找到以下
的任何文档LOCAL_PROGUARD_FLAGS
LOCAL_PROGUARD_ENABLED
LOCAL_PROGUARD_FLAG_FILES
我可以告诉LOCAL_PROGUARD_FLAGS
的典型用法是识别proguard配置文件的位置,如下所示:
LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags
问题是我无法弄清楚它与LOCAL_PROGUARD_FLAG_FILES
的区别如何:
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_PROGUARD_ENABLED
可用于禁用proguard,但disabled
选项以外我不知道该选项还可以使用其他内容。
LOCAL_PROGUARD_ENABLED := disabled
有谁知道我在哪里可以找到这些构建选项的文档(官方或非官方)? Google似乎没有为我的搜索返回任何有用的内容。
答案 0 :(得分:6)
我也搜索了这些信息并偶然发现了这个补丁:
Now the meaning of the LOCAL_PROGUARD_ENABLED options: * full: Use the build system's default configurations: with shrink but no obfuscation or optimization, global proguard flags in build/core/proguard.flags are applied. * custom: The same as "full" except no aapt-generated resource-related proguard flags. * nosystem: Don't use any build system's default configurations; but aapt-generated proguard flags are still applied. You are responsible for any other flags. * disabled: Disable proguard. * obfuscation: The same as "full" but with obfuscation enabled. * optimization: The same as "full" but with optimization enabled. * no value (the default): The build system chooses the proper value: "full" if it's an app; "disabled" if it's a library.
这是链接: https://android.googlesource.com/platform/build/+/7311a34%5E!/