flutter_launcher_icons not working (app launcher icon broken/crashed)

2.6k Views Asked by At

I'm struggling with changing App Launcher Icon using flutter_launcher_icons package, on my iPhone Simulator (iOS 14.4).

In my pubspec.yaml:

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.9.2

flutter_icons:
  #image_path_android: "assets/icon.png"
  image_path: "assets/icon.png"
  android: false
  ios: true

On VScode terminal (in my project root directory):

> flutter pub run flutter_launcher_icons:main
  ════════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.9.1)                               
  ════════════════════════════════════════════
  
• Overwriting default iOS launcher icon with new icon

✓ Successfully generated launcher icons

> flutter run                     ✔
Multiple devices found:
Android SDK built for x86 (mobile) • emulator-5554                        • android-x86 • Android
11 (API 30) (emulator)
iPhone 12 Pro Max (mobile)         • 0A68628E-A233-40C2-8B07-504F23A5FD81 • ios         •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
[1]: Android SDK built for x86 (emulator-5554)
[2]: iPhone 12 Pro Max (0A68628E-A233-40C2-8B07-504F23A5FD81)
Please choose one (To quit, press "q/Q"): 2
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install...                                             16.4s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        15.4s
Xcode build done.                                           267.2s
Syncing files to device iPhone 12 Pro Max...                        90ms

Flutter run key commands.
r Hot reload. 
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

An Observatory debugger and profiler on iPhone 12 Pro Max is available at:
http://127.0.0.1:51673/MS0nx6nWyeg=/
The Flutter DevTools debugger and profiler on iPhone 12 Pro Max is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:51673/MS0nx6nWyeg=/

But in the Simulator, app launcher icon is broken ('Runner' is the App):

enter image description here

In ~/ios/Runner/Assets.xcassets/AppIcon.appiconset/, I can see that the image files are correctly changed.

How can I fix this? Maybe it's not package problem, but iOS build problem??


  • Result of flutter doctor -v:
> flutter doctor -v               ✔
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-x64, locale ko-KR)
    • Flutter version 2.5.3 at /Applications/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (4 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/kws/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.11.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google
    Chrome.app/Contents/MacOS/google-chrome-unsafe)
    ! /Applications/Google Chrome.app/Contents/MacOS/google-chrome-unsafe is not executable.

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2019.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 43.0.2
    • Dart plugin version 192.8052

[✓] VS Code (version 1.62.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (2 available)
    • Android SDK built for x86 (mobile) • emulator-5554                        • android-x86 •
      Android 11 (API 30) (emulator)
    • iPhone 12 Pro Max (mobile)         • 0A68628E-A233-40C2-8B07-504F23A5FD81 • ios         •
      com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    ! Error: Errors were encountered while preparing your device for development. Please check the
      Devices and Simulators Window.  (code -1)

! Doctor found issues in 1 category.
3

There are 3 best solutions below

1
On BEST ANSWER

Solved. The problem was that I accidentally deleted all files at 'Copy Bundle Resources'.

Asset Catalog Compiler Options missing

2
On

Following are the some of the reasons why your app not showing app icon:

  1. You have provide incorrect image to flutter icon launcher in their documentation they mentioned: Check the dimension of the app icon file if it’s 1024x1024px.

  2. Check if AppIcon.appiconset generated properly and clearing showing in Xcode image assets.

  3. Check project app icon path is correctly set in Project General Settings.

4.Check restarting the simulator. Sometimes this also solves the problem.

2
On

Use an online tool like https://appicon.co and replace the AppIcon.appiconset folder.