【问题标题】:Could not build the application for the simulator but flutter build ios works无法为模拟器构建应用程序,但 Flutter build ios 可以工作
【发布时间】:2021-12-20 19:12:51
【问题描述】:

当我尝试从 Android Studio 运行我的应用时,我收到此错误:

warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set
to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'FMDB' from project 'Pods')
                    
[ +375 ms] Could not build the application for the simulator.
[   +2 ms] Error launching application on iPhone 8.
[   +9 ms] "flutter run" took 116,491ms.
[   +4 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:669:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:92:3)
           <asynchronous suspension>
           
           
[   +2 ms] Running shutdown hooks
[ +226 ms] Shutdown hooks complete
[  +11 ms] exiting with code 1
iDecode@iDecodes-mac foo % 

flutter build ios:

iDecode@iDecodes-Mac foo % flutter build ios
Building com.example.foo for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: ABCDEFHI9870
Running pod install...                                              1.6s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        7.1s
Xcode build done.                                           12.4s
Built /Users/iDecode/foo/build/ios/iphoneos/Runner.app.

我还可以在 Xcode 的同一个模拟器中运行这个应用程序。

这是我的 Flutter 医生:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, 2.6.0-11.0.pre, on macOS 11.6 20G165 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.49.0)
[✓] Connected device (3 available)

• No issues found!

【问题讨论】:

    标签: flutter android-studio intellij-idea


    【解决方案1】:

    在 PodFile 中取消注释平台并将其保留为 12.0 或 11.0。删除 PodFile.lock 并运行 pod install。在 xcode 中打开 wcworkspace,你会看到一个警告。单击警告,它将显示升级部署目标版本的选项。点击应用。关闭 xcode。现在,来自 Android Studio 的 ios 模拟器的颤振运行应该可以正常运行了。

    【讨论】:

    • 不幸的是它没有工作:(
    • 从android studio尝试flutter run -v并将日志粘贴到问题中。
    • 我已经粘贴了flutter run -v显示的相关错误。
    • 尝试使用稳定版本的flutter。您当前的版本似乎是一个开发频道。
    • 实际上,我还可以在真正的 iPhone 设备上从 Android Studio 运行该应用程序。我不知道模拟器有什么问题,我尝试了不同的模拟器,但都没有成功。
    猜你喜欢
    • 1970-01-01
    • 2021-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-15
    • 2021-12-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多