Reputation: 1503
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.
Code:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: "^0.7.0"
flutter_icons:
image_path: "icon/icon.png"
android: true
ios: true
Upvotes: 42
Views: 56210
Reputation: 51
1st Step :-
flutter pub get
dart run flutter_launcher_icons
after this all the icon images will be automatically generated by the package then
just remove the mipmap-anydpi-v26 generated folder then your problem will fixed...
Thank me later :)
Upvotes: 4
Reputation: 185
For Android:
Go to
android\app\src\main\res
and replaces all your icons here.
For iOS:
GO to
ios/runner/Assets.xcassets
and replaces all icons here.
You can use https://www.appicon.co/ to create your set for icon.
Upvotes: -1
Reputation: 11
refer this page for pubspec.yaml file editing: https://pub.dev/packages/flutter_launcher_icons
After editing the pubspec.yaml file run the following:
flutter clean
flutter pub get
flutter pub upgrade --major-versions
dart run flutter_launcher_icons
then go to : android\app\src\main\res folder then delete the mipmap-anydpi-v26 folder, then run your app, app icon and splash screen should be fixed now
Upvotes: 1
Reputation: 383
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:
Upvotes: 1
Reputation: 4110
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
Upvotes: 0
Reputation: 1316
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.
Upvotes: 1
Reputation: 21
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.
Upvotes: 1
Reputation: 492
Add flutter_launcher_icons: ^0.7.3 code Plugin to pubspec.yaml
in pubspec.yaml :
flutter_icons:
image_path_android: "images/logoapp.png"
image_path_ios: "images/logoapp.png"
android: true
ios: true
run command : flutter pub get
run command : flutter pub pub run flutter_launcher_icons:main
run command : flutter clean
run command : flutter run
it worked for me
Upvotes: 25
Reputation: 888
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.
Upvotes: 0
Reputation: 156
First add flutter_launcher_icons: ^0.8.1 code Plugin to pubspec.yaml
in pubspec.yaml file:
flutter_icons: image_path_android:"images/logoapp.png" image_path_ios:"images/logoapp.png" android:true ios:true
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.
Upvotes: 0
Reputation: 239
For me the folder drawable-v24
was a problem. After removing foreground.xml
from there it worked.
Upvotes: 4
Reputation: 3926
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.
similarly you can change appicon for ios, go
ios -> Runner -> Assets.xcassets -> Appicon.appiconset
then replace icons with your new icons
that's it!
Upvotes: 4
Reputation: 3336
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.
Upvotes: 6
Reputation: 1503
Able to change Now after following below Steps.
Upvotes: 18
Reputation: 27137
you have to get the package and then after run following command to change the icon.
$ flutter pub pub run flutter_launcher_icons:main
Upvotes: 70