【发布时间】: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
【问题讨论】:
-
GitHub 上有一个关于该错误的未解决问题:CocoaPods not installed or not in valid state。你试过运行
pod setup吗? -
也许更新会有帮助?当前 cocoapods 版本高于 1.9
-
也可以试试这张票:github.com/flutter/flutter/issues/54962 遇到与您相同问题的开发人员提出了一些解决方案。