How create keystore for release and not on debug? flutter
Asked Answered
P

3

9

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>
Panamerican answered 20/9, 2018 at 20:32 Comment(20)
could you post your folder structure for your android project?Smocking
How would i go about doing that?Panamerican
Just take a picture of your folder structure? Where do you defined the keyAlias, ... vars?Smocking
I defined it in key.properties, folder structure in editPanamerican
did you put the full path on " storeFile=<placeholder2> " ?Smocking
Im pretty positive that it is, under "users/myname/key.jks"... when i run "flutter build apk"when i put debug instead of release it works fine (see above question)Panamerican
It should be the full path... Eg: /home/users/yourname/yourkey.jksSmocking
On a mac the root is /Users i believe... i tried doing "home" and "macintosh HD", i guess there is something i missing there...Panamerican
Open your Terminal and type: pwdSmocking
It is just "/" and that signifies the hardrivePanamerican
Navigate to your key folder on terminal and type pwdSmocking
/Users/Myname/key.jksPanamerican
Is it the same as your storeFile var? Without <>Smocking
it is the exact samePanamerican
It's weird, are you sure there are no typo/case sensitive?Smocking
Could this be the problem..... the error has the root to my app directory too...." Keystore file /Users/myname/AndroidStudioProjects/ICISI/android/app/</Users/myname/key.jks> not found for signing config 'release'."Panamerican
Update the question with your real storeFile var.Smocking
it is updated ..Panamerican
Don't use < > chars remove thoseSmocking
Yup that was it, thank you so much for bearing with me.... the password also shouldn't use them eitherPanamerican
S
12

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

storePassword=yourpasswordhere
keyPassword=yourkeypasswordhere
keyAlias=youralias
storeFile=/your/path/key.jks
Smocking answered 21/9, 2018 at 1:50 Comment(0)
H
2

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

Hamza answered 6/9, 2019 at 0:20 Comment(1)
According to the documentation, kjs file should be kept somewhere safe, not public, and that should not be in you app folder.Silhouette
E
1

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.

Eggshaped answered 10/8, 2020 at 11:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.