【发布时间】:2022-01-04 14:53:53
【问题描述】:
我想使用 flutter_launcher_icons 更改我的应用程序图标:^0.9.2
它在我运行命令时显示错误 flutter pub run flutter_launcher_icons:main
Image of the error
试了很多次都没有新结果
【问题讨论】:
我想使用 flutter_launcher_icons 更改我的应用程序图标:^0.9.2
它在我运行命令时显示错误 flutter pub run flutter_launcher_icons:main
Image of the error
试了很多次都没有新结果
【问题讨论】:
我刚刚遇到了同样的问题,并在android/app/build.gradle 中解决了这个问题。
改变:
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
收件人:
minSdkVersion 26
targetSdkVersion 30
[编辑] 之后,我无法在模拟器上运行,所以我改回了 gradle 文件(没有再次运行 flutter_launcher_icon)。现在我的应用程序正在运行,并且图标是正确的。
【讨论】:
感谢answer,我能够解决这个问题!
【讨论】:
如果@Iagows 提出的解决方案对您不起作用,请查看以下内容: flutter_launcher_icons-issues
【讨论】:
插件的自述文件中的“依赖项不兼容”部分解释了该问题。它说
Because flutter_launcher_icons >=0.9.0 depends on args 2.0.0 and flutter_native_splash 1.2.0 depends on args ^2.1.1, flutter_launcher_icons >=0.9.0 is incompatible with flutter_native_splash 1.2.0.
And because no versions of flutter_native_splash match >1.2.0 <2.0.0, flutter_launcher_icons >=0.9.0 is incompatible with flutter_native_splash ^1.2.0.
So, because enstack depends on both flutter_native_splash ^1.2.0 and flutter_launcher_icons ^0.9.0, version solving failed.
pub get failed
解决方案以与上述描述一样神秘的方式给出,但@deffo 给出的简单技巧对我有用。 https://github.com/fluttercommunity/flutter_launcher_icons/issues/324#issuecomment-1013611137
当插件读取build.gradle 并强制minSdkVersion 成为您喜欢的任何版本时,您会跳过版本解决。
这是一个 hack,但由于您只自动生成应用程序图标一次且一劳永逸,谁在乎呢? :-)
顺便说一句,以下解决方案似乎更干净但我没有测试它:https://github.com/fluttercommunity/flutter_launcher_icons/issues/262#issuecomment-877653847
【讨论】: