flutter - 升级到 Flutter 到 2.5.0 后,无法从 Android Studio 的 iOS 模拟器运行应用程序
问题描述
我无法在 iOS 模拟器上运行我的应用程序。从 Flutter 2.2.3 升级到 Flutter 2.5.0 后出现此错误
我无法从 Android Studio 运行 Flutter 应用程序。但如果从 Xcode 打开项目,则应用程序将在 iOS 模拟器中正常运行。
这是错误/警告消息
ld: building for iOS Simulator, but linking in object file built for iOS, file '/Users/xxxxxxx/Documents/main_app/ios/Pods/GoogleMaps/Base/Frameworks/GoogleMapsBase.framework/GoogleMapsBase' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
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 14.2.99. (in target 'FMDB' from project 'Pods')
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 14.2.99. (in target 'libwebp' from project 'Pods')
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 14.2.99. (in target 'TOCropViewController' from project 'Pods')
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 14.2.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
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 14.2.99. (in target 'Reachability' from project 'Pods')
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 14.2.99. (in target 'Mantle' from project 'Pods')
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 14.2.99. (in target 'AppAuth' from project 'Pods')
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 14.2.99. (in target 'GoogleSignIn' from project 'Pods')
我已经尝试了 SO 的几种解决方案,但没有运气。到目前为止我尝试过的
- 扑干净
- 删除 podfile.lock。遵循这个
- 删除模拟器中的应用
这是我的颤振医生
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.2.1 20D74 darwin-x64, locale en-ID) [✓] Android 工具链 - 为 Android 设备开发 (Android SDK 版本 31.0.0) [✓] Xcode -为 iOS 和 macOS 开发 [✓] Chrome - 为网络开发 [✓] Android Studio(版本 2020.3)[✓] VS Code(版本 1.60.0)[✓] 连接设备(3 可用)
解决方案
将此代码添加到您的 Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
end
您可以将 9.0 更改为项目的部署目标版本。
推荐阅读
- java - 使用 selenium webdriver 时如何从列中获取特定值并将其插入字段中
- reporting-services - SSRS - 更改 x 轴以同时显示日期和小时数 - 问题
- hibernate - Grails 域映射到不需要的 _IDX 列
- python - 过滤中间模型并使用它来修改模型的查询集
- php - Laravel Voyager 属于多个关系显示“未找到结果”
- ios - 使用平移手势选择多个 tableview 单元格
- docker - Keycloak 在 Docker 中引发 SSL 连接错误
- typescript - 从 .jar 文件夹添加主类
- javascript - 我如何只调用一次函数,任何进一步的调用都返回第一次调用的最后一个值?
- javascript - 在javascript中没有发生多次下降到同一位置