在将Flutter升级到2.5.0后,无法在Android Studio中从iOS模拟器运行应用程序。

20 浏览
0 Comments

在将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的解决方案,但都没有什么结果。我迄今为止尝试过的方法包括:

  1. flutter clean
  2. 删除podfile.lock。遵循此链接
  3. 在模拟器中删除应用程序

这是我的Flutter Doctor:

[✓] Flutter(稳定通道,2.5.0,macOS 11.2.1 20D74 darwin-x64,本地环境为en-ID)

[✓] Android工具链-用于开发Android设备(Android SDK版本31.0.0)

[✓] Xcode-用于开发iOS和macOS [✓]

Chrome-用于Web开发[✓]

Android Studio(版本2020.3)[✓]

VS Code(版本1.60.0)[✓]

已连接设备(共3个可用)

admin 更改状态以发布 2023年5月21日
0
0 Comments

将此代码添加到您的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更改为您的项目的部署目标版本。

0