App Icon Setup
π Understanding App Iconsβ
App icons are platform-specific image files responsible for displaying your appβs icon on a device after installation. Both Android and iOS have their own icon requirements, ensuring proper visibility across different screen sizes and resolutions.
To update the app icon, you can:
- Manually replace icon resources in the Android and iOS directories.
- Use a package to automate icon generation.
π§ Automated Method (Recommended)β
Use the Flutter Launcher Icons package to generate icons easily.
1οΈβ£ Add Dependencyβ
Include the following in your pubspec.yaml
under dev_dependencies
:
dev_dependencies:
flutter_launcher_icons: any
2οΈβ£ Configure Iconsβ
Add the following configuration in pubspec.yaml
:
flutter_launcher_icons:
android: "ic_launcher"
ios: true
remove_alpha_ios: true
image_path: "assets/images/ic_launcher.png"
πΉ Optional Adaptive Icon Settings (Android Only)β
For Android adaptive icons, you can add:
adaptive_icon_foreground: "assets/images/ic_launcher_adaptive.png"
adaptive_icon_background: "#FFFFFF"
adaptive_icon_monochrome: "assets/images/ic_launcher_monochrome.png"
adaptive_icon_foreground_inset: 16
π Explanation of Parametersβ
Parameter | Description |
---|---|
image_path | (Required) Main icon file (512x512 recommended) for both Android and iOS. |
ios | true to generate iOS icons, false to skip. |
remove_alpha_ios | true removes the alpha layer from iOS icons for store upload. |
android | Icon name inside Android res folder. |
adaptive_icon_foreground | (Optional) Transparent PNG (512x512 or any size) for adaptive icon foreground. |
adaptive_icon_background | (Optional) Background color of adaptive icon. |
adaptive_icon_monochrome | (Optional) Monochrome icon (black/transparent) for notifications and Android 13+ themed icons. |
adaptive_icon_foreground_inset | (Optional) Padding for adaptive icon (default: 16 ). |
Note: If using adaptive icons, ensure the asset paths are registered under assets
in pubspec.yaml
.
3οΈβ£ Generate Iconsβ
Run the following command to apply changes:
dart run flutter_launcher_icons
πΉ Tip: Delete any existing icons with different shapes to prevent conflicts.
β After running this command, your app will have updated icons across Android and iOS!
π οΈ Manual Method (Optional)β
If you prefer not to use the package, you can manually replace icon files in the platform-specific directories.
π‘ You can use various free tools available online to generate all the required size-specific icon files from a single logo image, which you can then replace directly in the respective folders.
π± Androidβ
- Prepare icon assets in required resolutions (typically: 48x48, 72x72, 96x96, 144x144, 192x192, etc.).
- Replace the default icons in the following directory:
android/app/src/main/res/
Replace files in these subdirectories:
mipmap-mdpi/ic_launcher.png
mipmap-hdpi/ic_launcher.png
mipmap-xhdpi/ic_launcher.png
mipmap-xxhdpi/ic_launcher.png
mipmap-xxxhdpi/ic_launcher.png
For adaptive icons (if applicable), replace:
mipmap-anydpi-v26/ic_launcher.xml
mipmap-anydpi-v26/ic_launcher_round.xml
Also update or create foreground/background layers if needed:
res/drawable/ic_launcher_foreground.xml
res/drawable/ic_launcher_background.xml
π iOSβ
- Prepare a set of iOS app icons using Appleβs required sizes.
- Replace existing icons inside:
ios/Runner/Assets.xcassets/AppIcon.appiconset/
Replace all .png
files with correct sizes and update Contents.json
if necessary (or regenerate with Xcode's asset tool).
β After replacing manually, clean and rebuild your project to apply changes:
flutter clean
flutter pub get
flutter run