Sign APK without putting keystore info in build.gradle

后端 未结 12 957
栀梦
栀梦 2020-11-28 17:51

I am trying to setup signing process so that keystore password and key password are not stored in the project\'s build.gradle file.

Cur

12条回答
  •  时光取名叫无心
    2020-11-28 18:17

    The easiest way is to create a ~/.gradle/gradle.properties file.

    ANDROID_STORE_PASSWORD=hunter2
    ANDROID_KEY_PASSWORD=hunter2
    

    Then your build.gradle file can look like this:

    android {
        signingConfigs {
            release {
                storeFile file('yourfile.keystore')
                storePassword ANDROID_STORE_PASSWORD
                keyAlias 'youralias'
                keyPassword ANDROID_KEY_PASSWORD
            }
        }
        buildTypes {
            release {
                signingConfig signingConfigs.release
            }
        }
    }
    

提交回复
热议问题