Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find documentation for Android build options related to proguard

I have been doing a lot of work with the android build system and I ran into a situation that proguard was removing required classes causing a NoClassDefFoundError. I could tell the class was not being found however it took me a while to figure out that proguard was messing up the classes that were build with my code.

I finally found that I could prevent proguard from running by adding LOCAL_PROGUARD_ENABLED := disabled to the Android.mk file.

I was only able to do this because I happened to chance accross someone elses Android.mk file that did the same.

I have not been able to find any documentation for the following

LOCAL_PROGUARD_FLAGS
LOCAL_PROGUARD_ENABLED
LOCAL_PROGUARD_FLAG_FILES

As best I can tell the typical usage of LOCAL_PROGUARD_FLAGS is to identify the location of the proguard configuration file used as follows:

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

Problem is I cannot figure out how it differs from the LOCAL_PROGUARD_FLAG_FILES used as follows:

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

The LOCAL_PROGUARD_ENABLED can be used to disable proguard however other than the disabled option I don't know what else can be used with this option.

LOCAL_PROGUARD_ENABLED := disabled

Does anyone know where I can find documentation (official or unofficial) for these build options? Google does not seem to return anything useful for my searches.

like image 757
gnash117 Avatar asked Aug 05 '13 23:08

gnash117


1 Answers

I searched for that information also and stumbled upon this patch:

    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.

Here is the link: https://android.googlesource.com/platform/build/+/7311a34%5E!/

like image 148
JFDee Avatar answered Oct 18 '22 00:10

JFDee