android - 在哪里可以找到与混淆器相关的 Android 构建选项的文档

标签 android build build-process proguard

我一直在使用 android 构建系统做很多工作,我遇到了一个情况,proguard 正在删除所需的类,导致 NoClassDefFoundError。我可以看出没有找到该类,但是我花了一段时间才发现混淆器弄乱了用我的代码构建的类。

我终于发现我可以通过在 Android.mk 文件中添加 LOCAL_PROGUARD_ENABLED := disabled 来阻止混淆器运行。

我之所以能够做到这一点,是因为我偶然发现了其他人的 Android.mk 文件也这样做了。

我找不到以下内容的任何文档

LOCAL_PROGUARD_FLAGS
LOCAL_PROGUARD_ENABLED
LOCAL_PROGUARD_FLAG_FILES

据我所知,LOCAL_PROGUARD_FLAGS 的典型用法是识别混淆器配置文件的位置,如下所示:

LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags

问题是我无法弄清楚它与 LOCAL_PROGUARD_FLAG_FILES 有何不同,如下所示:

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

LOCAL_PROGUARD_ENABLED 可用于禁用混淆器,但除了 disabled 选项外,我不知道该选项还能用于什么。

LOCAL_PROGUARD_ENABLED := disabled

有谁知道我在哪里可以找到这些构建选项的文档(官方或非官方)? Google 似乎没有返回任何对我的搜索有用的信息。

最佳答案

我也搜索了该信息并偶然发现了这个补丁:

    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!/

关于android - 在哪里可以找到与混淆器相关的 Android 构建选项的文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18069474/

相关文章:

android - Sqlite - 条件选择?

android - 如何在 Android 中使用 JSON 从 MySQL 检索图像?

C++ 项目依赖项无法在特定的 macOS 机器上编译

在 Visual Studio Online 构建上安装 Bower

build-process - 您对非递归 make 有什么经验?

ant - hudson 依赖项

android - IntelliJ 调试器在 Android NullPointerException 上完全丢失?

android - 对早期设备使用 Roboto 字体

xcode4 : reliably detect the DerivedData directory of a project/workspace

python - 从源代码构建 Python 为 64 位