【问题标题】:flutter_launcher_icons not working Unhandled exception: FormatException: Invalid number (at character 1)flutter_launcher_icons 不起作用未处理的异常:FormatException:无效数字(在字符 1 处)
【发布时间】:2022-01-04 14:53:53
【问题描述】:

我想使用 flutter_launcher_icons 更改我的应用程序图标:^0.9.2
它在我运行命令时显示错误 flutter pub run flutter_launcher_icons:main
Image of the error


试了很多次都没有新结果

【问题讨论】:

    标签: flutter-dependencies


    【解决方案1】:

    我刚刚遇到了同样的问题,并在android/app/build.gradle 中解决了这个问题。

    改变:

    minSdkVersion flutter.minSdkVersion
    targetSdkVersion flutter.targetSdkVersion
    

    收件人:

    minSdkVersion 26
    targetSdkVersion 30
    

    Source

    [编辑] 之后,我无法在模拟器上运行,所以我改回了 gradle 文件(没有再次运行 flutter_launcher_icon)。现在我的应用程序正在运行,并且图标是正确的。

    【讨论】:

    【解决方案2】:

    感谢answer,我能够解决这个问题!

    【讨论】:

      【解决方案3】:

      如果@Iagows 提出的解决方案对您不起作用,请查看以下内容: flutter_launcher_icons-issues

      【讨论】:

        【解决方案4】:

        插件的自述文件中的“依赖项不兼容”部分解释了该问题。它说

        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

        【讨论】:

          猜你喜欢
          • 2022-11-14
          • 2021-06-11
          • 2021-04-07
          • 2020-03-07
          • 1970-01-01
          • 2022-11-07
          • 2021-05-30
          • 1970-01-01
          • 2019-12-19
          相关资源
          最近更新 更多