Search code examples
androidandroid-studioandroid-7.0-nougatandroid-7.1-nougatandroid-studio-2.3

Unable to sign apk "with only the traditional scheme" even after setting 'v2SigningEnabled' as false


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

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:

enter image description here

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

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'

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

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


Solution

  • 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.

    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.

    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)