1
新建文件
新建key.properties
app/android/key.properties
key.properties在android文件下。和android/app同级
文件中的代码
storePassword=123456
keyPassword=123456
keyAlias=key0
storeFile=/Users/.../app/android/xxx.jks
storePassword=新建xxx.jks文件时的密码
keyPassword=新建xxx.jks文件时的密码
keyAlias=新建xxx.jks文件时的Alias
storeFile=新建xxx.jks文件的绝对路径
2
文件中添加代码
app/android/app/build.gradle
第一行添加
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
android {
compileSdkVersion 29
上边添加
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29
}
defaultConfig {}
后天添加
defaultConfig {}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
网友评论