Chr*_*ris 8 dart dart-pub flutter flutter-dependencies pubspec
我想为 flutter 创建启动器图标。我的配置(pubspec.yaml)如下所示。
\n...\n  # The following adds the Cupertino Icons font to your application.\n  # Use with the CupertinoIcons class for iOS style icons.\n  cupertino_icons: ^1.0.2\n  flutter_spinkit: ^5.1.0\n  url_launcher: ^6.0.17\n  http: ^0.13.4\n  intl: ^0.17.0\n  flutter_launcher_icons: ^0.9.2\n\nflutter_icons:\n  android: true\n  ios: true\n  image_path: "assets/logo_blue.png"\n...\nRun Code Online (Sandbox Code Playgroud)\n我通过控制台安装了 flutter_launcher_icon ( flutter pub add flutter_launcher_icons)。之后,我将配置(见上文)添加到 pubspec.yaml 文件中,并在控制台中输入以下两个命令:
flutter pub get\nflutter pub run flutter_launcher_icons:main\nRun Code Online (Sandbox Code Playgroud)\n如文档中所述(https://pub.dev/packages/flutter_launcher_icons)。但在第二个命令之后,我收到以下错误消息,并且 pub 已完成,退出代码为 255。
\n  \xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\n     FLUTTER LAUNCHER ICONS (v0.9.1)\n  \xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\n\n\n\xe2\x9c\x93 Successfully generated launcher icons\nUnhandled exception:\nFormatException: Invalid number (at character 1)\n\n^\n\n#0      int._handleFormatError (dart:core-patch/integers_patch.dart:129:7)\n#1      int.parse (dart:core-patch/integers_patch.dart:55:14)\n#2      minSdk (package:flutter_launcher_icons/android.dart:309:18)\n#3      createIconsFromConfig (package:flutter_launcher_icons/main.dart:94:47)\n#4      createIconsFromArguments (package:flutter_launcher_icons/main.dart:60:7)\n#5      main (file:///C:/Users/chris/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/bin/main.dart:6:26)\n#6      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)\n#7      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)\npub finished with exit code 255\nRun Code Online (Sandbox Code Playgroud)\n我做错了什么?
\n谢谢!
\n小智 12
尝试将 minSdkVersion 的值更改为 23,将 targetSdkVersion 的值更改为 23。然后只需运行以下命令:flutter pub run flutter_launcher_icons:main
小智 5
在您的项目中,转到 android/app/build.gradle 并将 minSdkVersion 和 targetSdkVersion 更改为整数值。
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Run Code Online (Sandbox Code Playgroud)
然后运行以下命令
flutter pub get
flutter pub run flutter_launcher_icons:main
Run Code Online (Sandbox Code Playgroud)
        |   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           10157 次  |  
        
|   最近记录:  |