Create a KEYSTORE for Flutter applications, followed by building and releasing the app

Create a KEYSTORE for Flutter applications, followed by building and releasing the app

To publish your app on the Google Play Store, it is essential to digitally sign your application using a Keystore.

When users download the .apk file, it is signed with a "deployment key". An "upload key" is used to authenticate the .aab or .apk file uploaded by developers to the Play Store. Once uploaded, the Play Store re-signs it with the deployment key.


Article content

1. Generating a Keystore:

Run the following command to generate your keystore on Mac/Linux :

keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias appName        

Run this on Windows (replace USER_NAME with your username):

keytool -genkey -v -keystore C:/Users/USER_NAME/key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias appName        

You will be prompted to provide details such as name, password, and location. Once completed, confirm by selecting "YES."

2. Create key.properties file under Android :

Next, create a key.properties file in the Android directory with the following content:

storePassword= password keyPassword = password keyAlias=appName storeFile=C:\\Users\\USER_NAME\\Desktop\\appName.jks

  • storePassword and keyPassword: Enter the correct password you used when generating the keystore.
  • keyAlias: Use the alias provided during keystore creation.
  • storeFile: Specify the path where the keystore file is stored.

3. Updating build.gradle :

Open the build.gradle and add following code,

3.1 Add this block before the android section:

def keystoreProperties = new Properties()def keystorePropertiesFile = rootProject.file('key.properties')if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}        

3.2 Add the following block inside the android section:

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

4. Final Steps:

  1. Update version name and version number in pubspec.yaml.
  2. Run this in command line in your Terminal flutter clean .
  3. flutter build appbundle --release. This will generate a release .aab file, which you can upload to the Play Store.

For more information, please refer to the official documentation:

Flutter Android Deployment Guide

PANJIT KUMAR

Design Manager at NEXEND PVT LTD

4mo

DO YOU Need 12 Testers for 14 Days GUARANTEED PRODUCTION APPROVAL ? Get 20+ Testers Who Test Your Apk Continuously For 14 days. I can help you to get 20+ tester, Who test your app for 14 days continuously. For google play closed testing Guaranteed Approval. ✅ Link - https://wa.me/qr/E7RBIQ3IQXCPK1 This is my WhatsApp link Link - t.me/Panjit_kumar This is my Telegram link We are waiting for your reply sir. Tell me if you're interested or not. ✅Guaranteed Production Approval 📱We have experience of testing more than 140 Apps in last 9 months. 🏆 100% Approval Rate

Like
Reply
sathish kumar R. K

senior software engineer

9mo

Very helpful🦾

To view or add a comment, sign in

Others also viewed

Explore topics