image here I am developing a Flutter app, and I am having trouble getting the custom launcher icon to appear on Android. Despite following the usual process of generating the icon and confirming that the image file is correctly placed, the default Android icon is still being displayed.
Here are the details of what I’ve done:
-
I’m using
flutter_launcher_icons
to generate the icons. -
My
pubspec.yaml
includes the following configuration:flutter_launcher_icons: android: "launcher_icon" ios: true image_path: "assets/images/icon.png" min_sdk_android: 21 # android min sdk min:16, default 21 web: generate: true image_path: "assets/images/icon.png" background_color: "#hexcode" theme_color: "#hexcode" windows: generate: true image_path: "assets/images/icon.png" icon_size: 48 # min:48, max:256, default: 48 macos: generate: true image_path: "assets/images/icon.png"
<application android:label="appName" android:name="${applicationName}" android:icon="@mipmap/launcher_icon">
-
I have already tried
flutter clean
and rebuilding the APK, but the custom icon still isn’t showing. -
I’ve also tried uninstalling and reinstalling the app on my device and cleared the app cache, but it still shows the default Android robot icon.
I’ve verified the image path and ensured that the icon is in PNG format, square, and meets the size recommendations.
Any idea why the launcher icon is not showing correctly on Android?
Environment:
-
Flutter version:
3.16.9
-
flutter_launcher_icons:
v0.13.1
-
Android SDK:
C:\Users\...
-
3
Answers
There is a bug currently on the flutter_launcher_icons package v.0.14.1 for android: https://github.com/fluttercommunity/flutter_launcher_icons/issues/600
Try using an earlier version (0.13.1) for now…
It seems like the issue is with the configuration in your pubspec.yaml file. The flutter_launcher_icons package expects the configuration to be under the flutter_icons key, not flutter_launcher_icons. Here’s how you can fix it:
Update your pubspec.yaml configuration: Replace flutter_launcher_icons: with flutter_icons:. Your updated configuration should look like this:
Regenerate the launcher icons:
Run the following commands in your terminal:
Clean and rebuild your project:
Verify the icon files: Ensure that the launcher icon files have been generated in the correct directories:
If your icon is black after build successfully, maybe you can try it:
Remember check your image path too!