flutter_launcher_icons 不工作(应用程序启动器图标 broken/crashed)
flutter_launcher_icons not working (app launcher icon broken/crashed)
我正在努力使用 flutter_launcher_icons 包在我的 iPhone 模拟器(iOS 14.4)上更改 App Launcher 图标。
在我的 pubspec.yaml
:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.9.2
flutter_icons:
#image_path_android: "assets/icon.png"
image_path: "assets/icon.png"
android: false
ios: true
在 VScode 终端上(在我的项目根目录中):
> flutter pub run flutter_launcher_icons:main
════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.9.1)
════════════════════════════════════════════
• Overwriting default iOS launcher icon with new icon
✓ Successfully generated launcher icons
> flutter run ✔
Multiple devices found:
Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android
11 (API 30) (emulator)
iPhone 12 Pro Max (mobile) • 0A68628E-A233-40C2-8B07-504F23A5FD81 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
[1]: Android SDK built for x86 (emulator-5554)
[2]: iPhone 12 Pro Max (0A68628E-A233-40C2-8B07-504F23A5FD81)
Please choose one (To quit, press "q/Q"): 2
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install... 16.4s
Running Xcode build...
└─Compiling, linking and signing... 15.4s
Xcode build done. 267.2s
Syncing files to device iPhone 12 Pro Max... 90ms
Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
An Observatory debugger and profiler on iPhone 12 Pro Max is available at:
http://127.0.0.1:51673/MS0nx6nWyeg=/
The Flutter DevTools debugger and profiler on iPhone 12 Pro Max is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:51673/MS0nx6nWyeg=/
但在模拟器中,应用程序启动器图标坏了('Runner' 是应用程序):
在~/ios/Runner/Assets.xcassets/AppIcon.appiconset/
中,我可以看到图像文件已正确更改。
我该如何解决这个问题?也许这不是包问题,而是 iOS 构建问题??
flutter doctor -v
的结果:
> flutter doctor -v ✔
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-x64, locale ko-KR)
• Flutter version 2.5.3 at /Applications/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (4 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/kws/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.11.2
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google
Chrome.app/Contents/MacOS/google-chrome-unsafe)
! /Applications/Google Chrome.app/Contents/MacOS/google-chrome-unsafe is not executable.
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] IntelliJ IDEA Community Edition (version 2019.2.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 43.0.2
• Dart plugin version 192.8052
[✓] VS Code (version 1.62.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.28.0
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 •
Android 11 (API 30) (emulator)
• iPhone 12 Pro Max (mobile) • 0A68628E-A233-40C2-8B07-504F23A5FD81 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
! Error: Errors were encountered while preparing your device for development. Please check the
Devices and Simulators Window. (code -1)
! Doctor found issues in 1 category.
使用 https://appicon.co 等在线工具并替换 AppIcon.appiconset
文件夹。
以下是您的应用未显示应用图标的部分原因:
您在他们提到的文档中为 flutter 图标启动器提供了错误的图像:检查应用程序图标文件的尺寸是否为 1024x1024 像素。
检查 AppIcon.appiconset 是否正确生成并清除 Xcode 图像资产中的显示。
检查项目应用程序图标路径是否在项目常规设置中正确设置。
4.Check 正在重启模拟器。有时这也能解决问题。
已解决。问题是我不小心删除了 'Copy Bundle Resources'.
的所有文件
Asset Catalog Compiler Options missing
我正在努力使用 flutter_launcher_icons 包在我的 iPhone 模拟器(iOS 14.4)上更改 App Launcher 图标。
在我的 pubspec.yaml
:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.9.2
flutter_icons:
#image_path_android: "assets/icon.png"
image_path: "assets/icon.png"
android: false
ios: true
在 VScode 终端上(在我的项目根目录中):
> flutter pub run flutter_launcher_icons:main
════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.9.1)
════════════════════════════════════════════
• Overwriting default iOS launcher icon with new icon
✓ Successfully generated launcher icons
> flutter run ✔
Multiple devices found:
Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android
11 (API 30) (emulator)
iPhone 12 Pro Max (mobile) • 0A68628E-A233-40C2-8B07-504F23A5FD81 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
[1]: Android SDK built for x86 (emulator-5554)
[2]: iPhone 12 Pro Max (0A68628E-A233-40C2-8B07-504F23A5FD81)
Please choose one (To quit, press "q/Q"): 2
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running pod install... 16.4s
Running Xcode build...
└─Compiling, linking and signing... 15.4s
Xcode build done. 267.2s
Syncing files to device iPhone 12 Pro Max... 90ms
Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
An Observatory debugger and profiler on iPhone 12 Pro Max is available at:
http://127.0.0.1:51673/MS0nx6nWyeg=/
The Flutter DevTools debugger and profiler on iPhone 12 Pro Max is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:51673/MS0nx6nWyeg=/
但在模拟器中,应用程序启动器图标坏了('Runner' 是应用程序):
在~/ios/Runner/Assets.xcassets/AppIcon.appiconset/
中,我可以看到图像文件已正确更改。
我该如何解决这个问题?也许这不是包问题,而是 iOS 构建问题??
flutter doctor -v
的结果:
> flutter doctor -v ✔
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-x64, locale ko-KR)
• Flutter version 2.5.3 at /Applications/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (4 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/kws/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.11.2
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google
Chrome.app/Contents/MacOS/google-chrome-unsafe)
! /Applications/Google Chrome.app/Contents/MacOS/google-chrome-unsafe is not executable.
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] IntelliJ IDEA Community Edition (version 2019.2.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 43.0.2
• Dart plugin version 192.8052
[✓] VS Code (version 1.62.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.28.0
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 •
Android 11 (API 30) (emulator)
• iPhone 12 Pro Max (mobile) • 0A68628E-A233-40C2-8B07-504F23A5FD81 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
! Error: Errors were encountered while preparing your device for development. Please check the
Devices and Simulators Window. (code -1)
! Doctor found issues in 1 category.
使用 https://appicon.co 等在线工具并替换 AppIcon.appiconset
文件夹。
以下是您的应用未显示应用图标的部分原因:
您在他们提到的文档中为 flutter 图标启动器提供了错误的图像:检查应用程序图标文件的尺寸是否为 1024x1024 像素。
检查 AppIcon.appiconset 是否正确生成并清除 Xcode 图像资产中的显示。
检查项目应用程序图标路径是否在项目常规设置中正确设置。
4.Check 正在重启模拟器。有时这也能解决问题。
已解决。问题是我不小心删除了 'Copy Bundle Resources'.
的所有文件Asset Catalog Compiler Options missing