Android Studio 无法识别 cocoapods

mid*_*ite 5 cocoapods flutter

概括

\n

我的 Android Studio 无法识别 cocoapods,即使它已经安装了。

\n

问题

\n

当我运行main.dartiPhone 11 设备时,它显示以下错误消息:

\n
Launching lib/main.dart on iPhone 11 in debug mode...\nWarning: CocoaPods not installed. Skipping pod install.\n  CocoaPods is used to retrieve the iOS and macOS platform side\'s plugin code that responds to your plugin usage on the Dart side.\n  Without CocoaPods, plugins will not work on iOS or macOS.\n  For more info, see https://flutter.dev/platform-plugins\nTo install:\n  sudo gem install cocoapods\n\nCocoaPods not installed or not in valid state.\nError launching application on iPhone 11.\n
Run Code Online (Sandbox Code Playgroud)\n

当我选择Android(Pixel 3a)作为模拟器时,它可以成功运行。

\n

环境

\n

平台

\n

macOS Catalina v10.15.6

\n

颤动版本

\n
Launching lib/main.dart on iPhone 11 in debug mode...\nWarning: CocoaPods not installed. Skipping pod install.\n  CocoaPods is used to retrieve the iOS and macOS platform side\'s plugin code that responds to your plugin usage on the Dart side.\n  Without CocoaPods, plugins will not work on iOS or macOS.\n  For more info, see https://flutter.dev/platform-plugins\nTo install:\n  sudo gem install cocoapods\n\nCocoaPods not installed or not in valid state.\nError launching application on iPhone 11.\n
Run Code Online (Sandbox Code Playgroud)\n

扑医生

\n
$ flutter --version\nFlutter 1.20.3 \xe2\x80\xa2 channel stable \xe2\x80\xa2 https://github.com/flutter/flutter.git\nFramework \xe2\x80\xa2 revision 216dee60c0 (11 days ago) \xe2\x80\xa2 2020-09-01 12:24:47 -0700\nEngine \xe2\x80\xa2 revision d1bc06f032\nTools \xe2\x80\xa2 Dart 2.9.2\n
Run Code Online (Sandbox Code Playgroud)\n

宝石列表 cocoapods

\n
$ flutter doctor\nDoctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale ja-JP)\n\n[\xe2\x9c\x93] Android toolchain - develop for Android devices (Android SDK version 29.0.2)\n[\xe2\x9c\x93] Xcode - develop for iOS and macOS (Xcode 11.6)\n[\xe2\x9c\x93] Android Studio (version 4.0)\n[\xe2\x9c\x93] VS Code (version 1.48.2)\n[\xe2\x9c\x93] Connected device (1 available)\n\n\xe2\x80\xa2 No issues found!\n
Run Code Online (Sandbox Code Playgroud)\n

pubspec.yml

\n
$ gem list cocoapods\n\n*** LOCAL GEMS ***\n\ncocoapods (1.8.0)\ncocoapods-core (1.9.3, 1.8.0, 1.7.5)\ncocoapods-deintegrate (1.0.4)\ncocoapods-downloader (1.4.0)\ncocoapods-plugins (1.0.0)\ncocoapods-search (1.0.0)\ncocoapods-stats (1.1.0)\ncocoapods-trunk (1.5.0)\ncocoapods-try (1.2.0)\n
Run Code Online (Sandbox Code Playgroud)\n

小智 18

尝试从终端打开 Android Studioopen /Applications/Android\ Studio.app

这似乎解决了导致错误的 PATH 问题CocoaPods not installed。(https://github.com/flutter/flutter-intellij/issues/4981#issuecomment-751443625