flutter_launcher_icons 不工作未处理的异常:FormatException:无效数字(在字符 1)
flutter_launcher_icons not working Unhandled exception: FormatException: Invalid number (at character 1)
我想在 flutter 中使用 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 文件(没有再次 运行ning flutter_launcher_icon)。现在我有了应用 运行ning 并且图标是正确的。
如果@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 给出的简单 hack 对我有用。
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
多亏了这个answer,我才得以解决问题![=11=]
内部文件:~/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/lib/android.dart
替换行:
final String minSdk = line.replaceAll(RegExp(r'[^\d]'), '');
To this:
final String minSdk = "21"; // line.replaceAll(RegExp(r'[^\d]'), '');
保存文件然后运行:
flutter pub get
flutter pub run flutter_launcher_icons:main
来源:https://github.com/fluttercommunity/flutter_launcher_icons/issues/324
我想在 flutter 中使用 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 文件(没有再次 运行ning flutter_launcher_icon)。现在我有了应用 运行ning 并且图标是正确的。
如果@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 给出的简单 hack 对我有用。 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
多亏了这个answer,我才得以解决问题![=11=]
内部文件:~/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/lib/android.dart
替换行:
final String minSdk = line.replaceAll(RegExp(r'[^\d]'), '');
To this:
final String minSdk = "21"; // line.replaceAll(RegExp(r'[^\d]'), '');
保存文件然后运行:
flutter pub get
flutter pub run flutter_launcher_icons:main
来源:https://github.com/fluttercommunity/flutter_launcher_icons/issues/324