Flutter应用程序未在我的模拟器上启动

huangapple go评论86阅读模式
英文:

Flutter application didn't launch in my simulator

问题

以下是您的翻译:

我想在模拟器上启动我的Flutter应用程序,但遇到了一些问题。在构建项目方面我没有问题,但它在模拟器上创建了一个应用图标,启动一秒钟,然后关闭,什么也不发生。

附注:
我安装了两个Xcode版本14和14.3,问题出现在将Xcode更新到14.3版本之后。

这是我的终端日志:
在iPhone 14 Pro Max上以调试模式启动lib/main.dart...
运行pod install... 1,758毫秒
运行Xcode构建...
Xcode构建完成。46.8秒

这是我的fvm flutter doctor -v日志:
fvm flutter doctor -v
[!] Flutter(通道稳定,3.7.7,在macOS 13.3 22E252 darwin-arm64上,区域设置为en-UA)
• Flutter版本3.7.7,通道稳定,位于/Users//fvm/versions/3.7.7
! 警告:您的路径上的dart解析为/opt/homebrew/Cellar/dart/2.18.0/libexec/bin/dart,这不在您当前Flutter SDK检出的路径/Users//fvm/versions/3.7.7内。考虑将/Users//fvm/versions/3.7.7/bin添加到您的路径的前面。
• 上游存储库https://github.com/flutter/flutter.git
• 框架修订2ad6cd72c0(4周前),2023年03月08日09:41:59 -0800
• 引擎修订1837b5be5f
• Dart版本2.19.4
• DevTools版本2.20.1
• 如果这些是有意的,请忽略上述警告;然而,建议直接使用“git”执行更新检查和升级。

[✓] Android工具链 - 为Android设备开发(Android SDK版本33.0.0)
• Android SDK位于/Users//Library/Android/sdk
• 平台android-33,构建工具33.0.0
• Java二进制文件位于:/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java版本OpenJDK运行时环境(构建11.0.15+0-b2043.56-8887301)
• 所有Android许可证已接受。

[✓] Xcode - 为iOS和macOS开发(Xcode 14.0)
• Xcode位于/Applications/Xcode copy.app/Contents/Developer
• 构建14A309
• CocoaPods版本1.12.0

[✓] Chrome - 为Web开发
• Chrome位于/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio(版本2022.1)
• Android Studio位于/Applications/Android Studio.app/Contents
• Flutter插件可从以下位置安装:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart插件可从以下位置安装:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java版本OpenJDK运行时环境(构建11.0.15+0-b2043.56-8887301)

[✓] VS Code(版本1.77.0)
• VS Code位于/Applications/Visual Studio Code.app/Contents
• Flutter扩展版本3.62.0

[✓] 连接设备(共3个可用)
• iPhone 14 Pro Max(移动设备)• 237C4493-9B18-4B40-8495-FA2B6C181137• ios• com.apple.CoreSimulator.SimRuntime.iOS-16-4(模拟器)
• macOS(台式机)• macos• darwin-arm64• macOS 13.3 22E252 darwin-arm64
• Chrome(Web)• chrome• web-javascript• Google Chrome 111.0.5563.146

[✓] HTTP主机可用性
• 所有所需的HTTP主机都可用

!Doctor在1个类别中发现了问题。

英文:

I want to launch my flutter application on simulator and I have some problem with it. I have no problems with building the project, but it create an app icon on simulator and launch for one second, then it turns off and nothing happens.

PS:
I have two Xcode versions 14 and 14.3 installed, the problem with the project build appeared after updating Xcode to version 14.3

It's my terminal log:
Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
Running pod install... 1,758ms
Running Xcode build...
Xcode build done. 46.8s

Heare my fvm flutter doctor -v log:
fvm flutter doctor -v
[!] Flutter (Channel stable, 3.7.7, on macOS 13.3 22E252 darwin-arm64, locale en-UA)
• Flutter version 3.7.7 on channel stable at /Users//fvm/versions/3.7.7
! Warning: dart on your path resolves to /opt/homebrew/Cellar/dart/2.18.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users//fvm/versions/3.7.7. Consider adding /Users//fvm/versions/3.7.7/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2ad6cd72c0 (4 weeks ago), 2023-03-08 09:41:59 -0800
• Engine revision 1837b5be5f
• Dart version 2.19.4
• DevTools version 2.20.1
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users//Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
• Xcode at /Applications/Xcode copy.app/Contents/Developer
• Build 14A309
• CocoaPods version 1.12.0

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
• 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.15+0-b2043.56-8887301)

[✓] VS Code (version 1.77.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.62.0

[✓] Connected device (3 available)
• iPhone 14 Pro Max (mobile) • 237C4493-9B18-4B40-8495-FA2B6C181137 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.3 22E252 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 111.0.5563.146

[✓] HTTP Host Availability
• All required HTTP hosts are available

! Doctor found issues in 1 category.

答案1

得分: 0

以下是已翻译的部分:

"After some time I found the following error:
Exception NSException * "FirebaseApp.configure() could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com." 0x00006000005811a0

Here's how I solved it:
Here are the steps to add the GoogleService-Info.plist file to your Xcode project:

  • Go to the Firebase Console at https://console.firebase.google.com/
  • Select your project and click on the gear icon in the top left corner to go to Project settings.
  • In the Project settings page, scroll down to the "Your apps" section and click on the iOS app you want to configure.
  • In the "App settings" section, scroll down to the "GoogleService-Info.plist" section and click on the "Download GoogleService-Info.plist" button.
  • Save the downloaded file to your local computer.
  • Open your Xcode project and drag the downloaded GoogleService-Info.plist file into your Xcode project. Make sure to select the option to copy the file if needed.
  • In Xcode, select your project in the project navigator, and then select your target. In the "General" tab, scroll down to the "Frameworks, Libraries, and Embedded Content" section.
  • Make sure that the GoogleService-Info.plist file is listed under the "Copy Bundle Resources" section. If it's not, click the "+" button and add it."
英文:

After some time I found the following error:
Exception NSException * "FirebaseApp.configure() could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/." 0x00006000005811a0

Here's how I solved it:
Here are the steps to add the GoogleService-Info.plist file to your Xcode project:

  • Go to the Firebase Console at https://console.firebase.google.com/
  • Select your project and click on the gear icon in the top left corner to go to Project settings.
  • In the Project settings page, scroll down to the "Your apps" section and click on the iOS app you want to configure.
  • In the "App settings" section, scroll down to the "GoogleService-Info.plist" section and click on the "Download GoogleService-Info.plist" button.
  • Save the downloaded file to your local computer.
  • Open your Xcode project and drag the downloaded GoogleService-Info.plist file into your Xcode project. Make sure to select the option to copy the file if needed.
  • In Xcode, select your project in the project navigator, and then select your target. In the "General" tab, scroll down to the "Frameworks, Libraries, and Embedded Content" section.
  • Make sure that the GoogleService-Info.plist file is listed under the "Copy Bundle Resources" section. If it's not, click the "+" button and add it.

huangapple
  • 本文由 发表于 2023年4月4日 17:57:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75928010.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定