Generating a Pro Guard configuration file with Android Studio

后端 未结 3 1452
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 10:17

I am using Android Studio since 0.1.0 ... I just learned yesterday that Pro Guard seems to be integrated in newly created projects. Unfortunately this is not true for my pro

3条回答
  •  孤独总比滥情好
    2020-12-28 10:44

    I was also not able to do it through Android Studio. However, this worked for me.

    Add the following sections to the "android" section of your build.gradle file, filling in your own implementation details where appropriate.

    android {
    
    ...
    
        signingConfigs {
            releaseConfig {
                storeFile file("/dir/to/your.keystore")
                storePassword "xxx"
                keyAlias "yyy"
                keyPassword "xxx"
            }
        }
    
        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), '../your_proguard_file.txt'
                signingConfig signingConfigs.releaseConfig
            }
        }
    }
    

    In your project folder, run ./gradlew clean and ./gradlew assembleRelease

提交回复
热议问题