36

Am new to Flutter. I gone through the flutter documentation and followed the steps to configure custom launcher icons for my flutter project but app Launcher icon is not getting changed? Not sure what am missing.

enter image description here

Code:

dev_dependencies:
  flutter_test:
    sdk: flutter  
  flutter_launcher_icons: "^0.7.0"

flutter_icons:
  image_path: "icon/icon.png"
  android: true 
  ios: true
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
  • It's always better to share the code instead of image and explain problem in detail with your approach – Anmol Dec 29 '18 at 07:41
  • 4
    Did you run `flutter pub get` and `flutter pub pub run flutter_launcher_icons:main` on the terminal? – Jerome Escalante Dec 29 '18 at 07:51
  • @JeromeEscalante How can this be a duplicate, this seems to be an issue with the library – Manoj Perumarath Jan 10 '19 at 10:30
  • Does this answer your question? [How to change the application launcher icon on Flutter?](https://stackoverflow.com/questions/43928702/how-to-change-the-application-launcher-icon-on-flutter) – RobertoAllende Jun 18 '20 at 03:08

13 Answers13

62

you have to get the package and then after run following command to change the icon.

 $ flutter pub pub run flutter_launcher_icons:main
Viren V Varasadiya
  • 25,492
  • 9
  • 45
  • 61
22
  1. Add flutter_launcher_icons: ^0.7.3 code Plugin to pubspec.yaml

  2. in pubspec.yaml :

    flutter_icons:
      image_path_android: "images/logoapp.png"
      image_path_ios: "images/logoapp.png"
      android: true
      ios: true 
    
  3. run command : flutter pub get

  4. run command : flutter pub pub run flutter_launcher_icons:main

  5. run command : flutter clean

  6. run command : flutter run

it worked for me

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
hosein moradi
  • 444
  • 3
  • 7
17

Able to change Now after following below Steps.

  1. Add flutter_launcher_icons code Plugin to pubspec.yaml as mentioned in question
  2. In Command prompt run below commands
    • flutter pub get
    • flutter pub pub run flutter_launcher_icons:main
  3. And it worked
  4. Launcher Icons I generated using external website https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html
Jerome Escalante
  • 4,027
  • 2
  • 17
  • 17
5

I wasn't using flutter_launcher_icons, I was using just Image Asset Studio in the Android project. It seemed that in certain situations it wasn't updating my Adaptive Icon on Android.

To fix it, I opened the Android module (right click on the android/ folder in the Flutter view, then select Flutter | Open Android Module in Android Studio). From there, open the res/ folder and delete everything that looks like foreground.xml. AFAICT this is what is generated by Image Asset Studio as part of the Adaptive Icon.

Then recreate the Adaptive Icon via Image Asset Studio.

At this point my Flutter cache was corrupted, so I had to run flutter pub cache repair (I mention this because maybe somehow that is what fixed it, but I doubt it). Run the app and then voila, the icon updated.

user1978019
  • 3,008
  • 1
  • 29
  • 38
4

there is two way to update app icon

1) first way

dev_dependencies:
  flutter_test:
    sdk: flutter  

  flutter_launcher_icons: "^0.7.5"

flutter_icons:
  image_path: "icon/appicon.png"
  android: true 
  ios: true

run this two command

flutter pub get

flutter pub run flutter_launcher_icons:main

2) if above not work then below solutions (change in native)

you can change appicon from Image Asset, right click on main folder of your project structure and go new -> Image Asset , now just select your icon and finish it, Android studio will generate all necessary icons for you.

here look of Image Asset

similarly you can change appicon for ios, go

ios -> Runner -> Assets.xcassets -> Appicon.appiconset

then replace icons with your new icons

that's it!

Mayur Dabhi
  • 3,607
  • 2
  • 14
  • 25
3

For me the folder drawable-v24 was a problem. After removing foreground.xml from there it worked.

stan
  • 229
  • 3
  • 10
1

Those who had faced problems in changing the flutter icon in VS code, go to android/app/build.gradle. Then change the value of the following two properties:

// minSdkVersion 26
// targetSdkVersion 30

Then the same process.

ouflak
  • 2,458
  • 10
  • 44
  • 49
Morshed
  • 21
  • 4
0

First add flutter_launcher_icons: ^0.8.1 code Plugin to pubspec.yaml

in pubspec.yaml file:

  1. flutter_icons: image_path_android:"images/logoapp.png" image_path_ios:"images/logoapp.png" android:true ios:true

  2. check iOS -Folder -> Runner -> Assets.xcassets -> AppIcon.appiconset: if duplicates exist delete them.

run commands : flutter pub get run commands : flutter pub pub run flutter_launcher_icons:main run commands : flutter clean run commands : flutter run

This worked for me.

Can Kaplan
  • 146
  • 1
  • 7
0

For anyone getting any errors when they try to run flutter pub pub run flutter_launcher_icons:main, you may have not added Flutter to PATH. Follow this answer here to add Flutter to Path.

Kenneth Murerwa
  • 778
  • 12
  • 16
0

I realized that there is a Contents.json file under ios/Runner/Assets.xcassets/AppIcon.appiconset that contains the name of the previous png files, which didn't match the new files that was replaced in that folder.

I properly updated the json file with the new file names, then removed the application on my simulator and run the build again. Then I could see the new icon on ios.

Andi Keikha
  • 1,246
  • 2
  • 16
  • 37
0

Just run the following flutter launcher icon docs and then run your app.

DiyorbekDev
  • 706
  • 1
  • 5
  • 19
MDias
  • 41
  • 5
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Vikram Parimi Sep 11 '22 at 12:12
0

If you have flavors in IOS,

Goto Xcode > Runner > Build Settings > Asset Catalog Compiler - options > Primary App Icon Set Name and add values for each flavor

Bensal
  • 3,316
  • 1
  • 23
  • 35
0

the library now requires

flutter_launcher_icons:
  android: true
  ios: true
  image_path: "assets/icon.png"

The difference is flutter_icons: or flutter_launcher_icons:

kenta_desu
  • 303
  • 1
  • 9