I tried following this tutorial: https://pub.dev/packages/flutter_launcher_icons
So I set these keys in my pubspec.yaml:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: "^0.14.1"
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^4.0.0
flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/icon2.png"
and executed:
flutter clean
flutter pub get
flutter pub run flutter_launcher_icons
Get noticed some outdated packages, but I thought it should still work:
Resolving dependencies...
Downloading packages...
collection 1.18.0 (1.19.0 available)
leak_tracker 10.0.5 (10.0.7 available)
leak_tracker_flutter_testing 3.0.5 (3.0.8 available)
material_color_utilities 0.11.1 (0.12.0 available)
meta 1.15.0 (1.16.0 available)
string_scanner 1.2.0 (1.3.0 available)
test_api 0.7.2 (0.7.3 available)
Got dependencies!
7 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
flutter pub run flutter_launcher_icons
succeeded without issues. I later tested that it actually found the file by letting it look for a file that doesn’t exist and it threw an error as expected:
Deprecated. Use `dart run` instead.
Building package executable...
Built flutter_launcher_icons:flutter_launcher_icons.
════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.14.1)
════════════════════════════════════════════
• Creating default icons Android
• Adding a new Android launcher icon
• Creating mipmap xml file Android
WARNING: Icons with alpha channel are not allowed in the Apple App Store.
Set "remove_alpha_ios: true" to remove it.
• Overwriting default iOS launcher icon with new icon
No platform provided
✓ Successfully generated launcher icons
After executing all this and running the app via usb debugging on my android mobile phone, the app no longer has an icon (what I called invisible above). Before that it showed the generic flutter icon.
I have repeated the process with flutter pub run flutter_launcher_icons:main
and dart run flutter_launcher_icons
instead and have also tried removing the alpha channel from the icon. This didn’t change the result. The icon is a 512×512 png.
I am unsure on how to debug this issue further.
1