flutter 无法生成启动程序图标PathNotFoundException:无法打开文件,路径= 'assets/app_logo.png'

h79rfbju  于 2023-08-07  发布在  Flutter
关注(0)|答案(2)|浏览(276)

我试图为我的应用程序创建一个应用程序徽标,因为我即将部署和发布它,但这里有个问题。我试图让终端生成启动图标,我从网站上复制了代码:

flutter pub get
flutter pub run flutter_launcher_icons

字符串
然而,当我在终端上运行这段代码时,结果如下:

Warning: flutter_icons has been deprecated please use flutter_launcher_icons instead in your yaml files
• Creating default icons Android

✕ Could not generate launcher icons
PathNotFoundException: Cannot open file, path = 'assets/app_logo.png' (OS Error: The system cannot find the file specified.
, errno = 2)


我已经在我的pubsec.yaml上添加了图标启动器包代码:

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.13.1

flutter_icons:
   android: true
   ios: true
   image_path: "assets/app_logo.png"


但由于某种原因,系统无法找到特定的图像文件,例如我已经确保图像文件名在我的pubsecyaml中正确输入(如上所示),基于项目IRC:
https://i.stack.imgur.com/wxDds.png
但我还是不明白是什么问题,有人能帮助我,这样我就可以正确地解决这个问题。
我希望系统正确读取图像文件以生成启动图标。

wgeznvg7

wgeznvg71#

尝试使用这个:

flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/app_logo.png"
  min_sdk_android: 21

字符串
如果您查看错误,它显示flutter_icon已贬值,请使用flutter_launcher_icons

gojuced7

gojuced72#

如错误所示:

flutter_icons has been deprecated please use flutter_launcher_icons

字符串
从pubspec中删除旧的软件包并使用更新的软件包:flutter_launcher_icons

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

相关问题