gpt4 book ai didi

android - 为什么我的自定义构建类型给出 apk not signed 错误

转载 作者:搜寻专家 更新时间:2023-11-01 09:22:26 26 4
gpt4 key购买 nike

我有以下 app.gradle 配置:

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

debug {
debuggable true
// more configs here
}

staging {
externalNativeBuild {
cmake {
cppFlags "-DDEBUG_FLAG"
}
}
}
}

staging 构建类型给出错误:

The apk for your currently selected variant is not signed.

最佳答案

显然,只有构建类型 releasedebug 配置了签名 key 。对于自定义构建类型,您必须通过以下方式手动设置它:

1) 使用调试签名配置

staging {
signingConfig signingConfigs.debug
...
}

2) 从配置了签名 key 的构建类型继承

staging {
initWith debug
...
}

3) generate a new key并创建您自己的签名配置

android {
signingConfigs {
keyStagingApp {
keyAlias 'stagingKey'
keyPassword 'stagingKeyPassword'
storeFile file('../stagingKey.jks')
storePassword 'stagingKeyPassword'
}
}
...
}

然后像这样配置暂存:

staging {
signingConfig signingConfigs.keyStagingApp
...
}

关于android - 为什么我的自定义构建类型给出 apk not signed 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53682713/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com