`flutter launcher icon` 不会改变。

huangapple go评论55阅读模式
英文:

flutter launcher icon does not change

问题

我已下载了一个示例应用项目,现在我想要更改它的图标。我已经安装了flutter_launcher_icons包。
我将以下内容添加到pubspec.yaml文件中:

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

flutter_icons:
  android: true
  ios: true
  image_path: "assets/icon/logo.png"
  remove_alpha_ios: true
  min_sdk_android: 21

运行以下命令:

flutter pub get
flutter pub run flutter_launcher_icons

它会给我一个成功的消息:

═══════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.11.0)
  ════════════════════════════════════════════

• Creating default icons Android
• Overwriting the default Android launcher icon with a new icon
• Overwriting default iOS launcher icon with new icon
Creating Icons for Web...
⚠️Requirements failed for platform Web. Skipped
Creating Icons for Windows...
⚠️Windows config is not provided or windows.generate is false. Skipped...
⚠️Requirements failed for platform Windows. Skipped
Creating Icons for MacOS...
⚠️Requirements failed for platform MacOS. Skipped

✓ Successfully generated launcher icons

但是,当我安装应用程序后,我看到的只是旧图标。问题的原因可能是什么?

英文:

I have downloaded a sample app project and now I want to change its icon. I have installed the flutter_launcher_icons package.
I added this to pubspec.yaml file

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

flutter_icons:
  android: true
  ios: true
  image_path: "assets/icon/logo.png"
  remove_alpha_ios: true
  min_sdk_android: 21

Run the following commands

flutter pub get
flutter pub run flutter_launcher_icons

It gives me success message

 ════════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.11.0)
  ════════════════════════════════════════════

• Creating default icons Android
• Overwriting the default Android launcher icon with a new icon
• Overwriting default iOS launcher icon with new icon
Creating Icons for Web...
⚠️Requirements failed for platform Web. Skipped
Creating Icons for Windows...
⚠️Windows config is not provided or windows.generate is false. Skipped...
⚠️Requirements failed for platform Windows. Skipped
Creating Icons for MacOS...
⚠️Requirements failed for platform MacOS. Skipped

✓ Successfully generated launcher icons

But When I install the app all I see is the old icon.
What might be the cause of the problem?

答案1

得分: 2

将您上面的代码更改为:

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/logo.png"

然后像以前一样运行以下命令:

flutter pub get
flutter pub run flutter_launcher_icons:main

然后从您的 Android 设备/模拟器中删除您的应用程序。再次运行您的应用程序,图标将会更改。

英文:

change your above code to

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/logo.png"

as you did before run the commands

flutter pub get  
flutter pub run flutter_launcher_icons:main

and then remove your application from android device/emulator.
run your application again and the icon will be changed..

huangapple
  • 本文由 发表于 2023年2月8日 20:20:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75385718.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定