'Flutter error: "CocoaPods not installed or not in valid state."
Could the problem be that Android Studio can't find the path to CocoaPods?
I'm trying to test my app on my iPhone from Android Studio. The error I get is
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 ran gem list and the list of installed gems include:
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)
I ran
sudo gem uninstall cocoapods && sudo gem install cocoapods
I ran
flutter clean
I restarted Android Studio.
I ran File > Invalidate Caches… > Invalidate and Restart.
I ran
cd ios
pod install
This threw this error:
[!] 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`).
The Stack Overflow answers about that error message say to fix the issue in Xcode. But when I try to open my Android Studio project in Xcode I get this error:
Could not open file. (/Users/TDK/StudioProjects/Kabbalah)
Here's an odd thing. When I uninstall cocoapods they don't go away:
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)
What do I do next? In case this wasn't obvious, I don't know how to use Xcode.
Solution 1:[1]
A response on IssueTracker says
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.
Here's how run your project from the CLI on the iOS simulator. cd into your project directory and run:
flutter emulators --launch apple_ios_simulator
flutter run lib/main.dart
To run your project on a connected iPhone from the CLI:
flutter devices
You'll see a list of emulators and your iPhone. Now run:
flutter run -d 00008030-0010783414089022
with your iPhone's ID, not mine.
That will launch lib/main.dart on your iPhone.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | shim |
