flutter启动器图标未更改

r7knjye2  于 2023-02-09  发布在  Flutter
关注(0)|答案(1)|浏览(182)

我已经下载了一个示例应用程序项目,现在我想更改它的图标。我已经安装了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

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

mklgxw1f

mklgxw1f1#

更改以上代码为

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

就像您在运行命令之前所做的那样

flutter pub get  
flutter pub run flutter_launcher_icons:main

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

相关问题