FlutterBoy396
  • Login
  • Register
TRENDING
  • Security
No Result
View All Result
  • Home
  • Learn Dart
  • Packages
  • Widgets
  • FlutterFlowLow Code
SUBSCRIBE
  • Home
  • Learn Dart
  • Packages
  • Widgets
  • FlutterFlowLow Code
No Result
View All Result
FlutterBoy396
No Result
View All Result
Home Flutter App Development

A Step-by-Step Guide to Generating a Signed APK in Flutter for Android Devices

by NaveenKumar Paramasivam
March 13, 2025
in Flutter App Development, How To
0
0
SHARES
25
VIEWS
Share on FacebookShare on Twitter

Reason for generating signed APK for devices ?

✅ Signed application have digital certificate created inside the app, it gives an authenticity of application and its run on Production Mode
✅ You can distribute to play store for public access (Google Play store not accepting unsigned app builds)

Creating Flutter Project using visual studio

Generating a Keystore and Alias

Generating of Keystore is an digital certificate of application, its generating an SHA key after compiling the all files. you can create an keystore by using both Android Studio and Visual Studio.

Android Studio using UI Interface for Generating the Keystore and VS Code using the CLI for creating the keystore file

Generate Key using CLI in VS Code

Set your cli path/Terminal to you flutter app project directory and use the below

⚠️ If KeyTool is not working, Check and update the Environment Path in your local machine – Read for Fix Issue

keytool -genkey -v -keystore my-release-key.jks -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

Fill the Following Input in CLI
Enter keystore password:
Re-Enter Password :
What is your first and last name?
What is the name of your organizational unit?
What is the name of your organization?
What is the name of your City or Locality?
What is the name of your State or Province?
What is the two-letter country code for this unit?

Is CN=[] , OU=[], O=[], L=[], ST=Tamilnadu, C=IN correct? :

Enter key password for <my-key-alias>:
Re-Enter new Password :

All of the details are entered, .Keystore File are generated at Project path 🎊

Next, Move the generated key store file to android/app directory

After moving that file to under the app bundle, you need to create “key.properties” under the android/ folder. This file have an keystore and alias password (This properies used for building an signed APK or app bundles)

storePassword= [yourpassword]
keyPassword= [yourpassword]
keyAlias=[keyalias name]
storeFile= [filename.jks]

Copy and paste this properites in the key.properties file then replace the information. the info are given during the keystore file creation

Configuring keystore properties to Gradle file

build.gradle file located under the android/app directory and copy the below code to configure the key.poperties file . paste under the Plugins block

def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader("UTF-8") { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
    flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
    flutterVersionName = "1.0"
}


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

Add SigninConfigs Block inside of defaultConfig block

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

Change the buildTypes.release mode from debug to release mode

 buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig = signingConfigs.release
        }
    }

Now you can , open the termial and execute the command to get an APK or AAB file for release

command for building APK (Used for local production Release)

flutter build apk --release

command for building AAB (Used for publishing Apps in Play store)

flutter build appbundle --release

ShareTweet

Related Posts

Flutter App Development

Important user-permission for flutter application

September 3, 2024
  • 315 Followers

Recommended

Important user-permission for flutter application

September 3, 2024

A Step-by-Step Guide to Generating a Signed APK in Flutter for Android Devices

March 13, 2025

A Step-by-Step Guide to Generating a Signed APK in Flutter for Android Devices

March 13, 2025

Important user-permission for flutter application

September 3, 2024

Categories

  • Flutter App Development
  • How To

Newsletter

  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2022 Flutterboy396 by Zerothrows.com

Welcome Back!

Sign In with Google
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Google
OR

Fill the forms below to register

*By registering into our website, you agree to the Terms & Conditions and Privacy Policy.
All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Homepages
    • Home – Layout 1
    • Home – Layout 2
  • How To
  • Apps
  • Devices

© 2022 Flutterboy396 by Zerothrows.com

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.