即使将“v2SigningEnabled”设置为 false,也无法“仅使用传统方案”签署 apk

Ham*_*sir 3 android android-studio android-7.0-nougat android-7.1-nougat android-studio-2.3

我将我的更新android-studio到最新的稳定版本,即“Android Studio 2.3”以及gradle2.3.0.

现在,当我尝试生成我的应用发布版本的签名 apk 时,这个“额外”的东西(签名版本:) 显示在最后一步:

在此处输入图片说明

我点击了“签名帮助”,这个页面被打开了。

我按照文档对我的 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'
Run Code Online (Sandbox Code Playgroud)

并尝试再次生成签名的 apk,但仍然显示了这个“额外”的东西。

什么我应该怎么办签署APK“只用传统的方式”?

rub*_*ees 5

您在顶部屏幕截图中看到的是用于创建签名 APK 的 Android Studio 向导。您想要的是勾选V1(Jar Signature)复选框。另一个复选框用于新签名。

您在build.gradle文件中的设置不会影响 Android Studio 向导向您显示的内容。它只影响来自命令行的构建。所以勾选 V1 然后完成就可以了。

我确实建议让您的项目为新签名做好准备,因为它大大减少了用户的安装时间(然后您可以勾选 V1V2 签名。V1 将用于向后兼容)