当直接运行release版本时,报错Error: The apk for your currently selected variant cannot be signed. Please specify a signing configuration for this variant (package64-release).
解决报错:添加签名,signingConfigs 写在buildTypes前面,添加signingConfig signingConfigs.release
android {
signingConfigs {
debug {
keyAlias 'xx'
keyPassword 'xx'
storeFile file('xx.jks')
storePassword 'xx'
v1SigningEnabled true
v2SigningEnabled true
}
release {
keyAlias 'xx'
keyPassword 'zikao.2021'
storeFile file('xx.jks')
storePassword 'xx'
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
debug {
minifyEnabled false
zipAlignEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
zipAlignEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}