Pull to refresh

Comments 2

На OS X можно хранить подобную информацию в Keychain и запрашивать ее оттуда при сборке
Как по мне, то хранить пароли в файле удобнее. Примерно так: stackoverflow.com/a/19603006/3047139
Естественно этот файл не коммитим в репозиторий.

У меня вот так:

build.gradle:
def Properties props = new Properties()
def propFile = new File('signing.properties')
if (propFile.canRead()){
    props.load(new FileInputStream(propFile))

    if (props!=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
            props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
        android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
        android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
        android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
        android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
    } else {
        println 'signing.properties found but some entries are missing'
        android.buildTypes.release.signingConfig = null
    }
} else {
    println 'signing.properties not found'
    android.buildTypes.release.signingConfig = null
}


signing.properties
STORE_FILE=...
STORE_PASSWORD=...
KEY_ALIAS=...
KEY_PASSWORD=...
Sign up to leave a comment.

Articles