Flutter error: "CocoaPods not installed or not in valid state."
Flutter error: "CocoaPods not installed or not in valid state."
问题可能是 Android Studio 找不到 CocoaPods 的路径吗?
我正尝试在我的 iPhone 上从 Android Studio 测试我的应用程序。我得到的错误是
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 see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
Exception: CocoaPods not installed or not in valid state.
I 运行 gem list
和已安装的 gem 列表包括:
gem list
cocoapods (1.11.2)
cocoapods-core (1.11.2)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)
我运行
sudo gem uninstall cocoapods && sudo gem install cocoapods
我运行
flutter clean
我重新启动了 Android Studio。
我运行File > Invalidate Caches… > Invalidate and Restart
.
我运行
cd ios
pod install
这引发了这个错误:
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
关于该错误消息的 Stack Overflow 回答说要解决 Xcode 中的问题。但是当我尝试在 Xcode 中打开我的 Android Studio 项目时,我得到了这个错误:
Could not open file. (/Users/TDK/StudioProjects/Kabbalah)
这是一件奇怪的事情。当我卸载 cocoapods
它们不会消失:
sudo gem uninstall cocoapods
Remove executables:
pod, sandbox-pod
in addition to the gem? [Yn]
Removing pod
Removing sandbox-pod
Successfully uninstalled cocoapods-1.11.2
➜ Kabbalah git:(main) ✗ gem list
*** LOCAL GEMS ***
abbrev (default: 0.1.0)
activesupport (6.1.4.4)
addressable (2.8.0)
algoliasearch (1.27.5)
atomos (0.1.3)
base64 (default: 0.1.0)
benchmark (default: 0.1.1)
bigdecimal (default: 3.0.0)
bundler (default: 2.2.32)
bundler-unload (1.0.2)
CFPropertyList (3.0.5)
cgi (default: 0.2.1)
claide (1.1.0, 1.0.3)
cocoapods (1.11.2)
cocoapods-core (1.11.2)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)
接下来我该做什么?如果这不是很明显,我不知道如何使用 Xcode.
IssueTracker 上的回复说
This problem is present with Android Studio Bumblebee on Mac.
Launching flutter from the IDE causes this issue where it can't find the Cocoapods path.
Forced to run flutter from terminal for it to work.
以下是如何在 iOS 模拟器上从 CLI 运行 您的项目。 cd
到您的项目目录和 运行:
flutter emulators --launch apple_ios_simulator
flutter run lib/main.dart
通过 CLI 运行 您在已连接 iPhone 上的项目:
flutter devices
您将看到一个模拟器列表和您的 iPhone。现在 运行:
flutter run -d 00008030-0010783414089022
用你 iPhone 的 ID,不是我的。
这将在您的 iPhone 上启动 lib/main.dart
。
该错误已在 Bumblebee 2021.1.1 补丁 #1(2022 年 2 月 9 日发布)中修复。
问题可能是 Android Studio 找不到 CocoaPods 的路径吗?
我正尝试在我的 iPhone 上从 Android Studio 测试我的应用程序。我得到的错误是
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 see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
Exception: CocoaPods not installed or not in valid state.
I 运行 gem list
和已安装的 gem 列表包括:
gem list
cocoapods (1.11.2)
cocoapods-core (1.11.2)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)
我运行
sudo gem uninstall cocoapods && sudo gem install cocoapods
我运行
flutter clean
我重新启动了 Android Studio。
我运行File > Invalidate Caches… > Invalidate and Restart
.
我运行
cd ios
pod install
这引发了这个错误:
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
关于该错误消息的 Stack Overflow 回答说要解决 Xcode 中的问题。但是当我尝试在 Xcode 中打开我的 Android Studio 项目时,我得到了这个错误:
Could not open file. (/Users/TDK/StudioProjects/Kabbalah)
这是一件奇怪的事情。当我卸载 cocoapods
它们不会消失:
sudo gem uninstall cocoapods
Remove executables:
pod, sandbox-pod
in addition to the gem? [Yn]
Removing pod
Removing sandbox-pod
Successfully uninstalled cocoapods-1.11.2
➜ Kabbalah git:(main) ✗ gem list
*** LOCAL GEMS ***
abbrev (default: 0.1.0)
activesupport (6.1.4.4)
addressable (2.8.0)
algoliasearch (1.27.5)
atomos (0.1.3)
base64 (default: 0.1.0)
benchmark (default: 0.1.1)
bigdecimal (default: 3.0.0)
bundler (default: 2.2.32)
bundler-unload (1.0.2)
CFPropertyList (3.0.5)
cgi (default: 0.2.1)
claide (1.1.0, 1.0.3)
cocoapods (1.11.2)
cocoapods-core (1.11.2)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)
接下来我该做什么?如果这不是很明显,我不知道如何使用 Xcode.
IssueTracker 上的回复说
This problem is present with Android Studio Bumblebee on Mac. Launching flutter from the IDE causes this issue where it can't find the Cocoapods path.
Forced to run flutter from terminal for it to work.
以下是如何在 iOS 模拟器上从 CLI 运行 您的项目。 cd
到您的项目目录和 运行:
flutter emulators --launch apple_ios_simulator
flutter run lib/main.dart
通过 CLI 运行 您在已连接 iPhone 上的项目:
flutter devices
您将看到一个模拟器列表和您的 iPhone。现在 运行:
flutter run -d 00008030-0010783414089022
用你 iPhone 的 ID,不是我的。
这将在您的 iPhone 上启动 lib/main.dart
。
该错误已在 Bumblebee 2021.1.1 补丁 #1(2022 年 2 月 9 日发布)中修复。