skip to Main Content


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


  1. 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…

    Login or Signup to reply.
  2. 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:

    1. Update your pubspec.yaml configuration: Replace flutter_launcher_icons: with flutter_icons:. Your updated configuration should look like this:

      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"
      
      
    2. Regenerate the launcher icons:
      Run the following commands in your terminal:

      flutter pub get 
      flutter pub run flutter_launcher_icons:main
      
    3. Clean and rebuild your project:

      flutter clean
      flutter build apk
      
    4. Verify the icon files: Ensure that the launcher icon files have been generated in the correct directories:

    android/app/src/main/res/mipmap-*/launcher_icon.png
    
    1. Double-check the image path: Confirm that the image at assets/images/icon.png exists and is accessible. The image should be:
    In PNG format
    Square (equal width and height)
    Of adequate resolution (recommend at least 1024x1024 pixels)
    
    1. Confirm AndroidManifest.xml configuration:Your AndroidManifest.xml seems correct, but just to be sure, it should include:
    <application
        android:label="appName"
        android:name="${applicationName}"
        android:icon="@mipmap/launcher_icon">
    
    1. Uninstall the existing app before reinstalling: Sometimes, cached icons might still display. Uninstall the app from your device completely before reinstalling it.
    Login or Signup to reply.
  3. If your icon is black after build successfully, maybe you can try it:

    image_path: "assets/images/icon.png"
    
    android: true
    ios: true
    image_path_android: "assets/images/icon.png"
    min_sdk_android: 21 # android min sdk min:16, default 21
    adaptive_icon_background: "#ffffff"
    adaptive_icon_foreground: "assets/images/icon.png"
    

    Remember check your image path too!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search