How create keystore for release and not on debug? flutter

Viewed 15255

I followed the steps for deployment for flutter using this website https://flutter.io/android-release/

And when i run flutter build apk i get this error

Execution failed for task ':app:validateSigningRelease'.
> Keystore file filepath/key.jks> not found for signing config 'release'.

what i'm i missing to make it so it will sign for release?

when i change the line signingConfig signingConfigs.release to signingConfig signingConfigs.debug in my build.gradle it works, but to need it to be sign for release

my build.gradle

signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release

            minifyEnabled true
            useProguard true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

folder structure:

Project

-Android
|-- .gradle
|-- app
|   |-- src
|   |   `-- main
|   |       |-- java
|   |       |-- res
|   |       `-- AndroidManifest.xml
|   `-- build.gradle
|-- gradle
|   `-- wrapper
|-- gradle.properties
|-- gradlew
|-- local.properties
|-- proguard-rules.pro
|-- gradlew.bat
`-- key.properties

i left out files under wrapper, java, and res

key.properties

storePassword=<placeholder1>
keyPassword=<placeholder1>
keyAlias=key
storeFile=</Users/Conner/key.jks>
3 Answers

You must remove the '<' chars, it's only as sample data.

storePassword=yourpasswordhere
keyPassword=yourkeypasswordhere
keyAlias=youralias
storeFile=/your/path/key.jks

To avoid conflicts place the key.jks file inside android\app\key folder and in key.properties file add

storePassword=yourpasswordhere keyPassword=yourkeypasswordhere keyAlias=youralias storeFile=key/key.jks

If you are using Android Studio and if you want to place your key in any folder other than android than you have to use the following format for storeFile in your key.properties file:

storePassword=app_bar_demo_key
keyPassword=app_bar_demo_key
keyAlias=app_bar_demo_key
storeFile=E:\\Dharmik\\Flutter\\Demo\\Keystore\\your_key_name.jks

I have demonstrated my keypath but you have to use the path where your key is stored but your path should be separated using '\\'(double backslash) instead of '\'(single backslash) as I have shown above.
Using this method you can place your key in any location you want.

Related