我正在尝试为我的应用程序生成一个签名的 APK,如果我只使用签名 V1,它就可以工作。当我使用签名V2然后用keytool检查apk时,输出是:
keytool -list -printcert -jarfile app-release.apk
Not a signed jar file
Run Code Online (Sandbox Code Playgroud)
这是 build.gradle:
def getProps(path) {
Properties props = new Properties()
props.load(project.rootProject.file(path).newDataInputStream())
return props
}
android {
...
signingConfigs {
debug {
try {
Properties props = getProps('./local.properties')
storeFile file(props.getProperty('DEBUG_STORE_FILE', ''))
keyAlias props.getProperty('DEBUG_KEY_ALIAS', '')
keyPassword props.getProperty('DEBUG_STORE_PASSWORD', '')
storePassword props.getProperty('DEBUG_STORE_PASSWORD', '')
v1SigningEnabled true
v2SigningEnabled false // enabling this generates unsigned apk
}
catch (ex) {
throw new InvalidUserDataException("You should define RELEASE_STORE_FILE, RELEASE_KEY_ALIAS, RELEASE_STORE_PASSWORD in local.properties.")
}
}
release { …Run Code Online (Sandbox Code Playgroud)