项目根路径有个local.properties,它默认是不会被git管理,所以通常签名密码保存在这里
1 local.properties加入
STORE_FILE=../sing.jks
STORE_PASSWORD=123456
KEY_ALIAS=xxx
KEY_PASSWORD=123456
(注意 ../sing.jks 表示签名文件放在项目根路径)
2 app的build.gradle 写法
signingConfigs {
def properties = new Properties()
def inputSteam = project.rootProject.file('local.properties').newDataInputStream()
properties.load(inputSteam)
signKey {
storeFile file(properties.getProperty('STORE_FILE'))
storePassword properties.getProperty('STORE_PASSWORD')
keyAlias = properties.getProperty('KEY_ALIAS')
keyPassword properties.getProperty('KEY_PASSWORD')
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.signKey
}
debug {
signingConfig signingConfigs.signKey
}
}
这样密码就可以不泄露到托管平台了
网友评论