我在根文件夹的keystore.properties
中具有以下 key 存储信息存储
storePassword=******
keyPassword=******
keyAlias=******
storeFile=/home/jerry/jerryKeyStore
和下面的gradle代码来加载它
// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")
// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()
// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
当我打开项目结构窗口的签名选项卡时,Android Studio会在所有签名字段中读取
Unrecognized value
。它还无法在设备上安装APK,并抛出一个错误,指出APK是使用其他 key 构建的。
我用以下
Android Studio:2.1.2
Gradle :2.1.0
最佳答案
确保您具有:
buildTypes {
debug {
signingConfig signingConfigs.debug
......
}
release {
signingConfig signingConfigs.release
...
}
}
在模块中。