Flutter-警告(未安装CocoaPods跳过pod安装)即使在安装时

kkih6yb8  于 2022-11-17  发布在  Flutter
关注(0)|答案(9)|浏览(203)

我正在尝试在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医生:

[✓] 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课程)。无论如何,我仍然没有找到一个解决这个欺骗性问题的方法,所以如果有人认识到一些东西,那就太好了!

4sup72z8

4sup72z81#

在应用程序终端打开模拟器后写入

** Flutter 运行**

在终端中
或者关闭Android Studio并打开终端并粘贴
打开/应用程序/Android\Studio.app
它将打开Android Studio,您可以正常运行

c2e8gylq

c2e8gylq2#

此错误开始出现在mac os更新后

Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.0.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: com.bloc.intellij_generator_plugin (3.3.0), Dart (211.7798), andrasferenczi.dart-data-plugin (0.2.0), com.thoughtworks.gauge (211.6693.111), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), io.flutter (63.2.2), org.intellij.plugins.markdown (211.7142.37)

在我的例子中,它是在vs代码中启动项目,或者使用命令flutter run运行项目

Android Canary最新版本解决了问题
更新:正如阿斯科特Harris提到的,Android Studio Bumblebee| 2021.1.1补丁1解决了问题

yeotifhr

yeotifhr3#

// uninstall
sudo gem uninstall cocoapods
brew uninstall cocoapods

// reinstall
sudo gem install cocoapods
pod setup

// rebuild
flutter build ios

然后,* 重新启动vscode和iTerm*(这很重要),并进行调试

eit6fx6z

eit6fx6z4#

只需打开终端并写入

sudo gem install cocoapods

这就解决了我问题

s1ag04yj

s1ag04yj5#

我有同样的问题,我安装了cocoapods,它现在工作。
只需复制并粘贴以下行即可安装cocopods:sudo gem install cocoapods
重新启动VSCode和终端。
然后运行应用程序。
我正在与IOS(iPhone 13)模拟器的MAC工作.
CocoaPods Guide.

zzwlnbp8

zzwlnbp86#

**步骤1:**关闭Android Studio
**步骤2:**打开 * 终端 *
**步骤3:**粘贴:

open /Applications/Android\ Studio.app

**第4步:**Android Studio 将自动打开。
步骤5:点击运行按钮

q3qa4bjr

q3qa4bjr7#

这是一个可怕的黑客,有时工作。
我从Visual Studio代码运行应用一次,然后在Android Studio中运行

pkmbmrz7

pkmbmrz78#

正如@islomkhuja-akhrarov提到的,这是一个Android Studio大黄蜂的问题,安装补丁1有所帮助

ttygqcqt

ttygqcqt9#

如果您正在更新xcode,也可能出现这种情况,因此请等待安装完成

相关问题