Flutter final release codes
Here are the steps to generate aab file
1. Create your Keystore
Keystore is the file you should have to sign your AAB file.
Run the following command in Terminal at your project's root directory.
keytool -genkey -v -keystore ttwenty.jks -keyalg RSA -keysize 2048 -validity 10000 -alias ttwenty
After entering this command, you will be asked to fill key's password and some information.
2. Create a reference file to Keystore
Create a file named key.properties at [project root]/android/
storePassword=password from previous step
keyPassword=password from previous step
keyAlias=ttwenty
storeFile=../../ttwenty.jks
if you create with different key alias, please specify it in keyAlias.
For storeFile if you choose to put Keystore file at the root of your Flutter's project directory. This file's path would work.
3. Modify app/build.gradle
Load keystore's properties
Open [project]/android/app/build.gradle, look for android block, and put following code at the top of its.
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
...
}
Replace buildTypes block
find buildTypes block. it should look like the below:
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.debug
}
}
you have to replace it with following code:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
4. Let's sign and build the release version
flutter clean
flutter pub get
flutter build appbundle
PLAYLIST : https://www.youtube.com/watch?v=i-5bw...
CODE and Assets : https://github.com/abidroid/t20_yt
keytool -genkey -v -keystore ardhsainkdelivery.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key0
Comments
Post a Comment