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
- Create a upload keystore
keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
- Reference the keystore from the app
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 signing in gradle
Configure gradle to use your upload key when building your app in release mode by editing the [project]/android/app/build.gradle file.
- Add the keystore information from your properties file before the android block:
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.
- Replace the buildTypes block:
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
}
}
- Reviewing the app manifest
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 or AAB
build APK with
flutter build apk
build aab with
flutter build appbundle
Top comments (0)