Flutter App: Change Icon, App/Package Name

How to Change App Name, Package Name, default Icon and Generate a Release Bundle in Flutter

Flutter App Android App

Flutter App Release

1. How to Change App Icon

  • Add the following in pubspec.yaml:
dev_dependencies:
  flutter_launcher_icons: ^0.13.1

flutter_launcher_icons:
  android: true
  ios: true
  image_path: "lib/assets/icon/round_icon.png"

flutter:
  assets:
    - lib/assets/icon/round_icon.png
        
  • Organize your assets folder like this:
my_flutter_project/
├── lib/
│   └── assets/
│       └── icon/
│           └── round_icon.png
├── pubspec.yaml
        
  • Run the following commands:
flutter pub get
flutter pub run flutter_launcher_icons
        

2. How to Change App Name

  • For Android, modify AndroidManifest.xml:
android/app/src/main/AndroidManifest.xml


        
  • For iOS, update Info.plist:
ios/Runner/Info.plist

CFBundleDisplayName
Your New App Name
        

3. How to Change Package Name

  • Update the applicationId in build.gradle:
android/app/build.gradle

defaultConfig {
    applicationId "com.yourcompany.app_name"
}
        
  • Update the namespace:
android {
    namespace "com.yourcompany.app_name"
}
        
  • Use the change_app_package_name package:
dev_dependencies:
  change_app_package_name: ^1.0.0
        
  • Run the following commands:
flutter pub get
flutter pub run change_app_package_name:main com.newcompany.app_name
flutter clean
flutter pub get
flutter run
        

4. How to Generate a Release Bundle

  • Generate a keystore:
keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
        
  • Configure signing in build.gradle:
android {
    signingConfigs {
        release {
            storeFile file("key.jks")
            storePassword "your_password"
            keyAlias "key"
            keyPassword "your_password"
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}
        
  • Build the release bundle:
flutter build appbundle --release
        
  • Locate the file in build/app/outputs/bundle/release/app-release.aab.

5. How to Create a Release APK

  • Run the following command:
flutter build apk --release
        
  • Locate the APK in build/app/outputs/flutter-apk/app-release.apk.

Leave a Reply