【问题标题】:Android Studio doesn't recognize cocoapodsAndroid Studio 无法识别 cocoapods
【发布时间】:2020-09-12 21:54:13
【问题描述】:

总结

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

问题

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

Launching lib/main.dart on iPhone 11 in debug mode...
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-plugins
To install:
  sudo gem install cocoapods

CocoaPods not installed or not in valid state.
Error launching application on iPhone 11.

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

环境

平台

macOS Catalina v10.15.6

颤振版本

$ flutter --version
Flutter 1.20.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 216dee60c0 (11 days ago) • 2020-09-01 12:24:47 -0700
Engine • revision d1bc06f032
Tools • Dart 2.9.2

扑医生

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.6 19G2021, locale ja-JP)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.48.2)
[✓] Connected device (1 available)

• No issues found!

宝石列表 cocoapods

$ gem list cocoapods

*** LOCAL GEMS ***

cocoapods (1.8.0)
cocoapods-core (1.9.3, 1.8.0, 1.7.5)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.4.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.5.0)
cocoapods-try (1.2.0)

pubspec.yml

name: jinro
description: A new Flutter application.
publish_to:
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  http: ^0.12.2
  flutter_secure_storage: ^3.3.3
  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter
flutter:
  uses-material-design: true

【问题讨论】:

标签: flutter cocoapods


【解决方案1】:

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

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

【讨论】:

  • 花了3个小时的时间,我发现这个解决方案最适合我
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-27
  • 2013-05-10
  • 2021-05-06
  • 2019-01-28
  • 2021-03-27
相关资源
最近更新 更多