我正在尝试在 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
-- 更新 --
我终于能够运行该应用程序了,我所做的就是从头开始将所有项目文件复制到一个新项目中,并且它工作正常。 可能是因为某种冲突而发生的,因为我导入了别人的项目(来自于安吉拉的 Flutter Udemy 课程)。 无论如何,我仍然没有找到解决这个令人沮丧的问题的方法,所以如果有人认出它会很棒!