gpt4 book ai didi

ios - Flutter - 警告(未安装 CocoaPods 跳过 pod 安装)即使已安装

转载 作者:行者123 更新时间:2023-12-05 00:23:03 24 4
gpt4 key购买 nike

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

Warning: CocoaPods not installed. Skipping pod install.CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.Without CocoaPods, plugins will not work on iOS or macOS.For more info, see https://flutter.dev/platform-pluginsTo install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

Exception: CocoaPods not installed or not in valid state.


我尝试了在互联网上找到的所有解决方案(Stackoverflow 和 GitHub),但似乎没有任何效果。
重要提示:当我尝试从 Xcode 而不是 Android Studio 运行应用程序时,出现以下错误:

The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.


所以我所做的是 - 将目录更改为 ios(在 Flutter 项目上)并运行:
pod init
pod install
尝试从 Xcode 再次运行,它运行良好。
在 Xcode 上运行后,我尝试从 Android Studio 运行它,但同样的错误发生在我身上,导致应用无法启动。
请帮忙,我在这个错误上花了几个小时。
flutter 医生:
[✓] 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 类(class))。
无论如何,我仍然没有找到解决这个令人沮丧的问题的方法,所以如果有人认出某些东西,那就太好了!

最佳答案

在应用终端打开模拟器后写入
flutter 跑
在终端
或者
关闭 Android Studio 并打开终端并粘贴
打开/Applications/Android\Studio.app
它将打开Android Studio,您可以正常运行

关于ios - Flutter - 警告(未安装 CocoaPods 跳过 pod 安装)即使已安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68446186/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com