7

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.

4
  • I'm not sure if its the same issue you are having, but it was they way I had installed cocoapods installed. I got around the issue, by installing via homebrew brew install cocoapods, followed up by a force link brew link --overwrite cocoapods Commented Jan 28, 2022 at 5:02
  • Thanks Jared but that didn't work. Commented Jan 28, 2022 at 16:48
  • 1
    Today several people reported the same problem in the Android Studio issue tracker. issuetracker.google.com/issues?q=cocoapods Commented Jan 28, 2022 at 18:35
  • thought I was the only one who had that issue - I was going crazy. Android Studio Bumblebee | 2021.1.1 (Build #AI-211.7628.21.2111.8092744, built on January 19, 2022) Commented Jan 28, 2022 at 21:02

4 Answers 4

7

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Then how to debug through terminal?
I don't think you can do hot restart through the terminal. I was able to test my app on my iPhone but I wouldn't want to make a lot of changes without the IDE.
3

If you have already installed Cocoapods and getting this error, just try to run from the terminal using flutter run command once . After the that you can switch to debug mode

Comments

1

The bug is fixed in Bumblebee 2021.1.1 Patch #1 (released 2022 February 9).

Comments

0
  1. Get the device identifier.
flutter devices
  1. Run the device once from terminal.
flutter run -d YOUR_DEVICE_IDENTIFIER --flavor YOUR_FLAVOR
  1. Go back to your editor run the app normally.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.