Flutter error: "CocoaPods not installed or not in valid state."

Where does Android Studio expect to find CocoaPods? Could the problem be that Android Studio can't find the path to CocoaPods?

I'm using Android Studio Bumblebee 2021.1.1.

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:

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

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`).

What should I do now?

For me this was resolved by opening the Android studio from terminal

open /Applications/Android\ Studio.app

Yes. "Android Studio Bumblebee | 2021.1.1 Patch 1" fixed the issue.

Error: No pubspec.yaml file found. This command should be run from the root of your Flutter project.

Flutter error: "CocoaPods not installed or not in valid state."
 
 
Q