Skip to content

Quick Guide for Flutter

Published:

Table of contents

Open Table of contents

Change App Display Name

Instead of changing the name in android, ios, etc.. separately, Use the package flutter_launcher_name

Add this to pubspect.yaml

dev_dependencies:
  flutter_launcher_name: "^<latest_version>"

flutter_launcher_name:
  name: "yourNewAppLauncherName"

Run the package with

flutter pub get
flutter pub run flutter_launcher_name:main

Change App Icon

Instead of changing the icon in android, ios, etc.. separately, Use the package flutter_launcher_icons

Add this to pubspec.yaml

dev_dependencies:
  flutter_launcher_icons: "^<latest_version>"

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/icon.png"

Run the package with

flutter pub get
flutter pub run flutter_launcher_icons:main

Build and release an Android app

Step By Step Procedures

keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
cd android
touch key.properties

Add the following to key.properties

storePassword=<upload-keystore-password>
keyPassword=<upload-keystore-password>
keyAlias=upload
storeFile=<location of the key store file, such as /Users/<user name>/upload-keystore.jks>

Configure gradle to use your upload key when building your app in release mode by editing the [project]/android/app/build.gradle file.

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

android {
      ...
}

Load the key.properties file into the keystoreProperties object.

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
    }
}

With the signing configuration info:

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

buildTypes {
    release {
        signingConfig signingConfigs.release
    }
}

Review the default App Manifest file, AndroidManifest.xml, located in [project]/android/app/src/main and verify that the values are correct, especially the following:

application Edit the android:label in the application tag to reflect the final name of the app. uses-permission Add the android.permission.INTERNET permission if your application code needs Internet access. The standard template does not include this tag but allows Internet access during development to enable communication between Flutter tools and a running app.

build APK with

flutter build apk

build aab with

flutter build appbundle

Checkout the official documentation

If you found this article helpful consider supporting me by Buying me a Coffee Buy Me A Coffee


Previous Post
Quick Guide for AWS
Next Post
How to Setup your MacBook Air M2 for Software Development