Create a keystore
If you have an existing keystore, skip to the next step. If not, create one by running the following at the command line:
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
Note: Keep this file private; do not check it into public source control.
Note: keytool may not be in your path. It is part of the Java JDK, which is installed as part of Android Studio. For the concrete path, run flutter doctor -v and see the path printed after ‘Java binary at:’, and then use that fully qualified path replacing java with keytool.
Reference the keystore from the app
Create a file named appdir/android/key.properties that contains a reference to your keystore:
storePassword=password from previous step
keyPassword=password from previous step
keyAlias=key
storeFile=location of the key store file, e.g. /Users/user name/key.jks
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Check the Description of this Tutorial: https://www.youtube.com/watch?v=nGvPNG-f1-o
OR Generate key using a tool
Download app Signing tool from : https://shatter-box.com/knowledgebase/android-apk-signing-tool-apk-signer/
Go To the Directory Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
Then type cmd and Enter
enter image description here
Follow Along to the video tutorial to generate the key, place the key anywhere you want then follow the next tutorial to wrap the key with app with the 1st tutorial.