Magnus
Magnus

Reputation: 18728

Need to enter keystore details manually in Android Studio even though they exist in build.gradle

I have the following lines in my "project module" build.gradle (i.e. in /ProjectName/ProjectName/build.gradle):

android {
    signingConfigs {
        release {
            keyAlias "mykeyalias"
            keyPassword "mykeypassword"
            storeFile file("/Users/MyUsername/Documents/AndroidStudio/android_keystore")
            storePassword "mykeystorepassword"
        }
    }
    compileSdkVersion 28
    buildToolsVersion '28.0.2'
    defaultConfig {
        applicationId "com.example.mypackagename"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        signingConfig signingConfigs.release
    }

    ...

Still, when I click Build->Generate signed APK..., I still have to enter everything manually. This used to work before, not sure when it broke. I have double- and triple checked the path to the keystore file.

Any ideas what could be wrong?

Upvotes: 0

Views: 106

Answers (1)

Qasim
Qasim

Reputation: 5321

Because it's working as designed, i-e whenever you select to generate signed apk from Build->Generate Signed APK that wizard will always ask you to enter keystore information regardless of any configs being mentioned in gradle files ( although you can mark checkbox to remember that info for later use.)

If you don't want to mention keystore infomation while generating build, switch to release variant and just select Build->Build APK(s). It will generate release apk with the signing configs you have mentioned in your build.gradle file.

Upvotes: 2

Related Questions