1. Defined in the current root gradle

    ext{

    PROGUARD_ENABLE = true
    Copy the code

    }

  2. Add the current buildTypes {to gradle in each module.

    Release {minifyEnabled rootProject.ext.PROGUARD_ENABLE // Open obfuscated proguardFiles getDefaultProguardFile('proguard-android.txt'), Pro '} debug {minifyEnabled false proguardFiles getDefaultProguardFile(' proGuard-android.txt ') 'proguard-rules.pro' }Copy the code

    }