如何使用 build.gradle 文件中的 V1(Jar 签名)或 V2(完整 APK 签名) [英] How to use V1 (Jar signature) or V2 (Full APK signature) from build.gradle file
问题描述
我的 gradle 文件中有这个:
I have this in my gradle file:
android {
signingConfigs {
mySigningConfig {
keyAlias 'theAlias'
keyPassword 'thePassword'
storeFile file('theKeystore.jks')
storePassword 'thePassword'
}
}
...
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.mySigningConfig
}
}
...
}
然后当我生成我的发布 APK 时,我只需转到 Build ->构建包/APK->构建 APK(s)
并创建 APK.不像我去 Build ->生成签名包/APK
,它提示我:
Then when I generate my release APK, I simply go to Build -> Build Bundle(s) / APK(s) -> Build APK(s)
and APK is created. Unlike if I go to Build -> Generate Signed Bundle / APK
, it prompts me for this:
我的问题是,我当前的 gradle 文件是用什么版本的签名生成的?是V1还是V2?如何修改我的 gradle 文件,以便它专门使用 V1 或 V2 构建?
My question is, what version of signature does my current gradle file generate with? Is it V1 or V2? How do I modify my gradle file so that it specifically build with V1 or V2?
推荐答案
找到了!我已经像这样调整了我的 gradle 文件:
Found it! I have adjusted my gradle file like so:
signingConfigs {
mySigningConfig {
keyAlias 'theAlias'
keyPassword 'thePassword'
storeFile file('theKeystore.jks')
storePassword 'thePassword'
v1SigningEnabled true
v2SigningEnabled true
}
}
这篇关于如何使用 build.gradle 文件中的 V1(Jar 签名)或 V2(完整 APK 签名)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!