Flutter 应用程序无法在 MacOS 上运行 -> 异常:启动 MacOS 应用程序时运行 pod install 时出错。在 MacOS 之外运行时不会出现错误

问题描述 投票:0回答:3

尝试在 macOS 上启动时收到此错误消息。

使用 iOS 模拟器、Android 模拟器或 Chrome Web 应用程序启动时没有任何问题。

我在 M1 Mac 上工作,我的终端通过 Rosetta 启动。

我已手动删除并重新安装 flutter 应用程序内 iOS 文件夹中的 pod。

请帮忙。下面是尝试运行应用程序时 VSCode 中的调试控制台以及 flutter doctor -v 的结果。

Launching lib/main.dart on macOS in debug mode...
CocoaPods' output:
↳
      Preparing
    Analyzing dependencies
    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    Fetching external sources
    -> Fetching podspec for `FlutterMacOS` from `Flutter/ephemeral`
    -> Fetching podspec for `audio_session` from `Flutter/ephemeral/.symlinks/plugins/audio_session/macos`
    -> Fetching podspec for `audioplayers` from `Flutter/ephemeral/.symlinks/plugins/audioplayers/macos`
    -> Fetching podspec for `device_info_plus_macos` from `Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos`
    -> Fetching podspec for `flutter_secure_storage_macos` from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`
    -> Fetching podspec for `just_audio` from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`
    -> Fetching podspec for `package_info_plus_macos` from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`
    -> Fetching podspec for `path_provider_macos` from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`
    -> Fetching podspec for `pdfx` from `Flutter/ephemeral/.symlinks/plugins/pdfx/macos`
    -> Fetching podspec for `printing` from `Flutter/ephemeral/.symlinks/plugins/printing/macos`
    -> Fetching podspec for `shared_preferences_macos` from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`
    -> Fetching podspec for `sqflite` from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`
    -> Fetching podspec for `url_launcher_macos` from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`
    -> Fetching podspec for `wakelock_macos` from `Flutter/ephemeral/.symlinks/plugins/wakelock_macos/macos`
    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
    [!] CocoaPods could not find compatible versions for pod "just_audio":
      In Podfile:
        just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`)
    Specs satisfying the `just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`)` dependency were found, but they required a higher minimum deployment target.
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'
    <internal:kernel>:90:in `tap'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:682:in `attempt_to_activate'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:94:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:416:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:161:in `install!'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod:25:in `load'
    /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod:25:in `<main>'
Exception: Error running pod install
Exited

Flutter Doctor -v如下:

[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-arm (Rosetta),
    locale en-US)
    • Flutter version 3.0.2 at /Users/jackestes/Flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (7 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
    • Android SDK at /Users/jackestes/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at:
      /opt/homebrew/Cellar/openjdk/18.0.1.1/libexec/openjdk.jdk/Contents/Home/bi
      n/java
    • Java version OpenJDK Runtime Environment Homebrew (build 18.0.1.1+0)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Coding/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Coding/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.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.1.1)
    • IntelliJ at /Applications/Coding/IntelliJ IDEA.app
    • 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

[✓] VS Code (version 1.68.1)
    • VS Code at /Applications/Coding/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 12.4 21F79 darwin-arm
      (Rosetta)
    • Chrome (web)    • chrome • web-javascript • Google Chrome 102.0.5005.115

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

• No issues found!
flutter macos cocoapods pod-install
3个回答
1
投票

在PodFile中取消注释平台版本并将其值更改为11或12


0
投票

删除Podfile.lock, 并运行 pod install


0
投票

您将什么设置为 macOS 的部署目标? 您需要增加 Podfile 中的版本,如下所示。

© www.soinside.com 2019 - 2024. All rights reserved.