简体   繁体   English

flutter_launcher_icons 不起作用(应用启动器图标损坏/崩溃)

[英]flutter_launcher_icons not working (app launcher icon broken/crashed)

I'm struggling with changing App Launcher Icon using flutter_launcher_icons package, on my iPhone Simulator (iOS 14.4).我正在努力在我的 iPhone 模拟器(iOS 14.4)上使用 flutter_launcher_icons 包更改应用程序启动器图标。

In my pubspec.yaml :在我的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

On VScode terminal (in my project root directory):在 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=/

But in the Simulator, app launcher icon is broken ('Runner' is the App):但在模拟器中,应用程序启动器图标已损坏(“Runner”是应用程序):

在此处输入图片说明

In ~/ios/Runner/Assets.xcassets/AppIcon.appiconset/ , I can see that the image files are correctly changed.~/ios/Runner/Assets.xcassets/AppIcon.appiconset/ ,我可以看到图像文件已正确更改。

How can I fix this?我怎样才能解决这个问题? Maybe it's not package problem, but iOS build problem??也许不是包问题,而是iOS构建问题??


  • Result of flutter doctor -v : 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文件夹。

Following are the some of the reasons why your app not showing app icon:以下是您的应用不显示应用图标的一些原因:

  1. You have provide incorrect image to flutter icon launcher in their documentation they mentioned: Check the dimension of the app icon file if it's 1024x1024px.您在他们提到的文档中为 flutter icon launcher 提供了不正确的图像:检查应用程序图标文件的尺寸是否为 1024x1024px。

  2. Check if AppIcon.appiconset generated properly and clearing showing in Xcode image assets.检查 AppIcon.appiconset 是否正确生成并清除显示在 Xcode 图像资产中。

  3. Check project app icon path is correctly set in Project General Settings.检查项目应用程序图标路径是否在项目常规设置中正确设置。

4.Check restarting the simulator. 4.检查重启模拟器。 Sometimes this also solves the problem.有时这也解决了问题。

Solved.解决了。 The problem was that I accidentally deleted all files at 'Copy Bundle Resources'.问题是我不小心删除了“复制捆绑资源”中的所有文件。

Asset Catalog Compiler Options missing 缺少资产目录编译器选项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM