【问题标题】:Flutter - Warning (CocoaPods not installed Skipping pod install) Even While InstalledFlutter - 警告(未安装 CocoaPods 跳过 pod 安装)即使已安装
【发布时间】:2021-09-27 10:52:36
【问题描述】:

我正在尝试在 Android Studio 上使用 Geolocator 插件构建 Flutter 应用程序。 当我运行应用程序时,我收到以下警告 - 这会阻止应用程序运行:

警告:未安装 CocoaPods。跳过 pod 安装。 CocoaPods 用于检索 iOS 和 macOS 平台端的插件代码,以响应您在 Dart 端的插件使用情况。 如果没有 CocoaPods,插件将无法在 iOS 或 macOS 上运行。 欲了解更多信息,请参阅https://flutter.dev/platform-plugins 要安装,请参阅https://guides.cocoapods.org/using/getting-started.html#installation 以获取说明。

例外:CocoaPods 未安装或未处于有效状态。

我尝试了在互联网(Stackoverflow 和 GitHub)上找到的所有解决方案,但似乎没有任何效果。

重要提示:当我尝试从 Xcode 而不是 Android Studio 运行应用程序时,出现以下错误:

沙盒与 Podfile.lock 不同步。运行“pod install”或更新您的 CocoaPods 安装。

所以我所做的是 - 将目录更改为 ios(在 Flutter 项目上)并运行:

pod init
pod install

尝试从 Xcode 再次运行,它运行良好。 在 Xcode 上运行后,我尝试从 Android Studio 运行它,但同样的错误发生在我身上,导致应用无法启动。

请帮忙,我在这个错误上花费了几个小时。

颤振医生:

[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-IL)
    • Flutter version 2.2.2 at /Users/idanrefaeli/Developer/flutter
    • Framework revision d79295af24 (5 weeks ago), 2021-06-11 08:56:01 -0700
    • Engine revision 91c9fc8fe0
    • Dart version 2.13.3

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/idanrefaeli/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/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.8+10-b944.6916264)

[✓] VS Code (version 1.57.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (2 available)
    • Idan’s (mobile) • 00008020-0011092101A2002E • ios            • iOS 14.6
    • Chrome (web)    • chrome                    • web-javascript • Google Chrome 91.0.4472.114

! Doctor found issues in 1 category.

额外日志: 在 Android Studio 中“运行”登录:pastebin.com/7iYtdcTQ 运行 'pod install' 后还有此终端日志:pastebin.com/1cCNuFYM

-- 更新--

我终于能够运行该应用程序,我所做的只是将所有项目文件从头开始复制到一个新项目中,并且它工作正常。 也许是因为某种冲突而发生的,因为我导入了别人的项目(来自 Angela Yu 的 Flutter Udemy 课程)。 无论如何,我仍然没有找到解决这个令人沮丧的问题的方法,所以如果有人能认出某些东西,那就太好了!

【问题讨论】:

  • 我在使用 VS Code 时遇到了同样的问题,但是当我重新打开它时解决了。
  • 我尝试重新打开,重新启动,flutter clean,一切
  • 请向我们展示完整的错误(打印)。我正在尝试重现它。
  • 这里:pastebin.com/7iYtdcTQ 运行“pod install”后的终端日志:pastebin.com/1cCNuFYM

标签: ios flutter dart cocoapods podfile


【解决方案1】:

这大部分是在不同机器上运行 Flutter 项目时出现的问题。

要解决,只需按照以下步骤操作即可

  1. cd ios
  2. pod install
  3. pod update
  4. 然后清理您的项目
  5. 重建您的项目

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-12
    • 1970-01-01
    • 2021-01-16
    • 2022-10-26
    相关资源
    最近更新 更多