Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use V1 (Jar signature) or V2 (Full APK signature) from build.gradle file

I have this in my gradle file:

android {
    signingConfigs {
        mySigningConfig {
            keyAlias 'theAlias'
            keyPassword 'thePassword'
            storeFile file('theKeystore.jks')
            storePassword 'thePassword'
        }
    }
    ...
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.mySigningConfig
        }
    }
    ...
}

Then when I generate my release APK, I simply go to Build -> Build Bundle(s) / APK(s) -> Build APK(s) and APK is created. Unlike if I go to Build -> Generate Signed Bundle / APK, it prompts me for this:

enter image description here

My question is, what version of signature does my current gradle file generate with? Is it V1 or V2? How do I modify my gradle file so that it specifically build with V1 or V2?

like image 583
user1506104 Avatar asked Sep 15 '19 10:09

user1506104


1 Answers

Found it! I have adjusted my gradle file like so:

signingConfigs {
    mySigningConfig {
        keyAlias 'theAlias'
        keyPassword 'thePassword'
        storeFile file('theKeystore.jks')
        storePassword 'thePassword'
        v1SigningEnabled true
        v2SigningEnabled true
    }
}

Reference: https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.SigningConfig.html

like image 140
user1506104 Avatar answered Sep 20 '22 12:09

user1506104