【问题标题】:failed to run the app from iOS simulator from Android Studio after upgrade to Flutter to 2.5.0升级到 Flutter 到 2.5.0 后,无法从 Android Studio 的 iOS 模拟器运行应用程序
【发布时间】:2021-11-07 10:33:18
【问题描述】:

我无法在 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. 扑干净
  2. 删除 podfile.lock。关注this
  3. 在模拟器中删除应用

这是我的 Flutter 医生

[✓] Flutter (Channel stable, 2.5.0, on macOS 11.2.1 20D74 darwin-x64, 语言环境en-ID) [✓] Android 工具链 - 为 Android 设备开发 (Android SDK 版本 31.0.0) [✓] Xcode - 为 iOS 和 macOS 开发 [✓] Chrome - 为网络开发 [✓] Android Studio(版本 2020.3)[✓] VS Code(版本 1.60.0)[✓] 已连接设备(3 个可用)

【问题讨论】:

    标签: flutter android-studio ios-simulator flutter-ios flutter-ios-build


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-14
      • 2021-06-07
      • 2016-07-29
      • 1970-01-01
      • 1970-01-01
      • 2022-10-05
      相关资源
      最近更新 更多