我将我的 android-studio
更新为最新的稳定版本,即“Android Studio 2.3
”,并将 gradle
更新为 2.3。 0
。
现在,当我尝试为我的应用程序的发布版本生成签名的 apk 时,这个“额外”的东西(签名版本:)在最后一步中显示:
我点击了“签名帮助”和这个 page打开了。
我按照文档对我的 build.gradle 文件进行了如下更改:
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
android {
signingConfigs {
config {
keyAlias 'xxxxxx'
keyPassword 'xxxxxx'
storeFile file('/Users/xxxxx')
storePassword 'xxxxxx'
v2SigningEnabled false
}
}
compileSdkVersion 25
buildToolsVersion "25.0.0"
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.xxxxx.xxx"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
maven { url 'https://maven.fabric.io/public' }
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.mikepenz:fastadapter:1.8.2@aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.google.firebase:firebase-database:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
并尝试再次生成已签名的 apk,但仍然显示这个“额外”的东西。
我现在应该怎么做才能“仅使用传统方案”对 apk 进行签名?
最佳答案
您在顶部屏幕截图中看到的是用于创建签名 APK 的 Android Studio 向导。您想要的是仅 V1(Jar 签名)复选框。另一个复选框用于新签名。
您在 build.gradle
文件中的设置不会影响 Android Studio 向导向您显示的内容。它只影响从命令行构建。所以勾选 V1 然后完成就可以了。
不过,我确实建议让您的项目为新签名做好准备,因为它大大减少了用户的安装时间(然后您可以勾选 V1 和 V2 签名。V1 是为了向后兼容)
关于android - 即使将 "with only the traditional scheme"设置为 false 后也无法签署 apk 'v2SigningEnabled',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42587750/