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'

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

现在应该怎么做才能“仅使用传统方案”签署 apk?

4

2 回答 2

5

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

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

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

于 2017-03-03T20:54:39.797 回答
1

请加

v2SigningEnabled false 在您的登录 buil.gradle 应用程序文件中

在此处输入图像描述

有关更多详细信息,请阅读文档

于 2019-11-01T14:00:21.847 回答