Release signing in gradle.properties for Android

后端 未结 6 1048
故里飘歌
故里飘歌 2021-01-30 23:20

So I\'m trying to convert all of my ant build scripts to gradle, and I\'ve been able to find ample resources and documentation on all of it except how to configure signing in th

6条回答
  •  情歌与酒
    2021-01-31 00:09

    Inspired by Eugens solution i came up with a little shorter variance. The code has to be in the android {} task configuration.

    File signFile = rootProject.file('sign.properties')
    if (signFile.exists()) {
        Properties p = new Properties()
        p.load(new FileInputStream(signFile))
        signingConfigs {
            releaseConfig {
                storeFile file(p.storeFile)
                storePassword p.storePassword
                keyAlias p.keyAlias
                keyPassword p.keyPassword
            }
        }
        buildTypes.release.signingConfig signingConfigs.releaseConfig
    }
    

提交回复
热议问题