无法“仅使用传统方案”签署apk。即使将'v2SigningEnabled'设置为false之后 [英] Unable to sign apk "with only the traditional scheme" even after setting 'v2SigningEnabled' as false

查看:1242
本文介绍了无法“仅使用传统方案”签署apk。即使将'v2SigningEnabled'设置为false之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的 android-studio 更新到了最新的稳定版本,即 Android Studio 2.3 以及渐​​变 2.3.0

I updated my android-studio to latest stable version i.e. 'Android Studio 2.3' and also the gradle to 2.3.0.

现在,当我尝试生成应用发布版本的签名apk时,在最后一步中将显示此额外内容(签名版本:):

Now, when I am trying to generate a signed apk of my app's release build, this "extra" thing (Signature versions:) is getting shown in the last step:

我点击了签名帮助,此页面已打开。

I clicked on 'Signature Help' and this page got opened.

我遵循文档并像下面这样更改了build.gradle文件:

I followed the doc and made changes to my build.gradle file like this:

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,但仍然显示出此额外内容。

and tried to generate the signed apk again but still this "extra" thing is getting shown.

应该我现在要签署仅使用传统方案的apk吗?

What should I do now to sign apk "with only the traditional scheme"?

推荐答案

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

What you see in the top screenshot is the Android Studio wizard for creating a signed APK. What you want is to tick only the V1 (Jar Signature) checkbox. The other checkbox is for the new signing.

build.gradle 文件中的设置不会影响Android Studio向导向您显示的内容。它仅影响命令行中的构建。因此,在V1之前打勾,然后再完成即可。

The setting you have in your build.gradle file does not affect what the Android Studio wizard shows to you. It only affects a build from the command line. So ticking V1 and then Finish will work just fine.

我确实建议您为新的签名做好项目准备,因为这会大大减少用户的安装时间。 (然后您将在V1 V2签名上打勾。V1用于向后兼容)

I do recommend to make your project ready for the new signing though, as it drastically reduces the installation time for your users (You would then tick V1 and V2 signing. V1 would be for backwards compability)

这篇关于无法“仅使用传统方案”签署apk。即使将'v2SigningEnabled'设置为false之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆