30

I used the desktop flutter and I searched for a way to do that I couldn't find any articles about that, so I want to know how to change the launcher app icon for Windows desktop and also for Mac and Linux.

[UPDATE] Now flutter_launcher_icons package supports all platforms

To set it up:

  1. Create a file and may name it as flutter_launcher_icons.yaml
  2. Add configuration to flutter_launcher_icons.yaml
  3. Specify image paths and platforms
dev_dependencies:
 flutter_launcher_icons: "^0.13.1"
flutter_launcher_icons:
 android: "launcher_icon"
 ios: true
 image_path: "assets/icon/icon.png"
 min_sdk_android: 21 # android min sdk min:16, default 21
 web:
 generate: true
 image_path: "path/to/image.png"
 background_color: "#hexcode"
 theme_color: "#hexcode"
 windows:
 generate: true
 image_path: "path/to/image.png"
 icon_size: 48 # min:48, max:256, default: 48
 macos:
 generate: true
 image_path: "path/to/image.png"
  1. Run pub get and the package
flutter pub get
flutter pub run flutter_launcher_icons -f flutter_launcher_icons.yaml
asked Oct 27, 2020 at 16:16

7 Answers 7

47

To change the icon you just need to replace the icon file in your project:

  • Windows: windows/runner/resources/app_icon.ico
  • macOS: macos/Runner/Assets.xcassets/AppIcon.appiconset

Linux doesn't have an icon set up in the template yet; you can follow this issue for updates.

answered Oct 28, 2020 at 15:11
Sign up to request clarification or add additional context in comments.

6 Comments

i made an ico file with my logo and replaced it with the ico file at resources/app_icon.ico but it did not change the icon
flutter build windows doesn't pick up windows/runner/resources/app_icon.ico for the release version. What am I missing?
Is there any way we could change the app icon in the runtime?
To anyone stumbling upon this issue: at first, it seems that replacing app_icon.ico won't do anything. I tried several other methods, including specifying another file in Runner.rc as mentioned below, but nothing seemed to work. In the end, I invalidated caches for Android Studio, rebooted my PC, run a flutter clean then rebuilt my app. In the end, the icon got updated by replacing app_icon.ico.
can confirm this works. I tried initially without reboot and didnt work then repeated with reboot and it got replaced
@il_boga You should file a bug; if it requires a clean that's something that should be fixed.
8

To change the icon in windows you have to keep the icon file in this location:

windows/runner/resources/

Then go into windows/runner/resources/Runner.rc file and search for the word app_icon. You will reach here:

IDI_APP_ICON ICON "resources\\app_icon.ico"

Replace the app_icon with your icon file name. Then run the command

flutter build windows
flutter run --release -d windows
answered Aug 6, 2021 at 7:26

Comments

2

For Linux

Best And Simple way is to use gtk_window_set_icon_from_file function

Edit Your my_application.cc file which is inside Linux folder linux/my_application.cc

  • before line gtk_widget_show(GTK_WIDGET(window));
  • add new line gtk_window_set_icon_from_file(GTK_WINDOW(window),"assets/icon.ico",NULL);
  • Icon recommends 48x48 pixel
answered Jul 27, 2022 at 8:07

5 Comments

didn't work for me
please show me your code
I added the line gtk_window_set_icon_from_file(GTK_WINDOW(window),"images-icons/out/icons/win/icon.ico",NULL); and there is no change in the linux executable appearance either. Does the icon need to be in assets/ and registered as an asset using pubspec.yaml perhaps?
Actually before I made the above code change, the default app icon was still the same generic grey gear symbol that I'm getting now - not even the classic flutter icon. So if the flutter team can't change the icon then what hope do we have!
Turns out that the gtk call above needs the icon file to be present at runtime, e.g. in the directory (or subdir) of the deployed executable. You will see a warning in the terminal when running if the icon file you specify cannot be found. So in the end I got the icon loading OK. However the icon of the deployed executable is still generic, and the icon as displayed in the Ubuntu dock at runtime remains generic - so there is no visible useful effect of this line of code, as far as I can see.
1

I hava the best way, using Flutter Launcher Icons for your Windows, Android etc.

  1. Edit your pubspec.yaml file:

dev_dependencies: flutter_launcher_icons: "^0.10.0"

flutter_icons:
 android: "launcher_icon"
 ios: true
 image_path: "assets/icon/icon.png"
 min_sdk_android: 21 # android min sdk min:16, default 21
 web:
 generate: true
 image_path: "path/to/image.png"
 background_color: "#hexcode"
 theme_color: "#hexcode"
 windows:
 generate: true
 image_path: "path/to/image.png"
 icon_size: 48 # min:48, max:256, default: 48
  1. Go to Terminal, run:
flutter pub get
flutter pub run flutter_launcher_icons:main

Note: Name of your icon is lowercase, don't use capital.

answered Aug 22, 2022 at 22:58

Comments

1

After trying all of these steps for weeks, what really worked for me was to change the app description on those fields on Runner.rc:

  • FileDescription
  • InternalName
  • OriginalFilename
  • ProductName

I also changed the BINARY_NAME description field on CMakeLists.txt.

After changing the description for some reason, the icon is updated. I didn't tried, but you can try to switch your app name back to the previous one after you successfully update the launcher app icon.

answered Nov 29, 2023 at 18:25

Comments

0

Here is my setup from flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19043.1110], locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.3)
[✓] Android Studio (version 4.1.0)
[✓] Android Studio
[✓] Connected device (3 available)
• No issues found!

Initially it didn't work by just replacing the icon and run

flutter build windows

and neither did

flutter clean
flutter build windows

I found that in the running mode the icon updates on the GUI, but unfortunately not in the EXE itself.

flutter run --release -d windows
answered Jul 26, 2021 at 3:44

Comments

0

This is what i did and worked for me 100%

dev_dependencies:
 flutter_launcher_icons: "^0.13.1"
flutter_launcher_icons:
 android: "launcher_icon"
 ios: true
 image_path: "assets/icon/icon.png"
 min_sdk_android: 21 # android min sdk min:16, default 21
 web:
 generate: true
 image_path: "path/to/image.png"
 background_color: "#hexcode"
 theme_color: "#hexcode"
 windows:
 generate: true
 image_path: "path/to/image.png"
 icon_size: 48 # min:48, max:256, default: 48
 macos:
 generate: true
 image_path: "path/to/image.png"
Run pub get and the package

at the end run these in terminal

flutter pub get
flutter pub run flutter_launcher_icons -f flutter_launcher_icons.yaml
answered Jan 27, 2024 at 19:34

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.