question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flutter not recognizing cocoapods inside Android Studio 4.1

See original GitHub issue

I cannot run any flutter development application inside Android Studio 4.1 stable on iOS using flutter and am not sure if it is an issue with Android Studio or the Flutter plugin. I am using macOS Catalina Version 10.15.7

I am able to build app within Xcode 12.0.1.

When I try it states:

Launching lib/main.dart on iPhone 11 Pro 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 Pro.

With that said I re-installed cocoapods using the following commands:

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.7.5
pod setup
sudo gem install cocoapods 

//to get latest version 1.9.3

The cocoapods were still not recognized after these commands.
I uninstalled and re-installed Android Studio.
This did not change the outcome.
I also tried the --pre version of cocoapods. No change.

ran these commands:

sudo gem update
sudo gem clean cocoapods

pod --version 
1.10.0.rc.1

sudo gem --version 
3.0.3

gem list cocoapods      

*** LOCAL GEMS ***

cocoapods (1.10.0.rc.1)
cocoapods-core (1.10.0.rc.1, 1.9.3, 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)

Android studio 4.1 has known issue of not recognizing Dart and Flutter plugins as noted: https://github.com/flutter/flutter/issues/67986

Running flutter doctor using button inside Android Studio on screen within the pubspec.yaml file produces the following:

/Users/tara/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.7 19H2, locale en-US)
    • Flutter version 1.22.2 at /Users/tara/flutter
    • Framework revision 84f3d28555 (4 days ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/tara/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    ✗ CocoaPods not installed.
        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

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin installed
    • Dart plugin version 202.7319.5

[✓] Connected device (2 available)
    • sdk gphone x86 arm (mobile) • emulator-5554                        • android-x86 • Android 11 (API 30) (emulator)
    • iPhone 11 Pro (mobile)      • B0415B3C-2E75-4FA5-85E4-425082E20A87 • ios         • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    ! Error: Tara’s iPhone is not connected. Xcode will continue when Tara’s iPhone is connected. (code -13)

! Doctor found issues in 2 categories.
Process finished with exit code 0

Running flutter doctor from terminal outside Android Studio produces the following:

Taras-Mac:~ tara$ flutter doctor -v

[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.7 19H2, locale en-US)
    • Flutter version 1.22.2 at /Users/tara/flutter
    • Framework revision 84f3d28555 (4 days ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/tara/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.10.0.rc.1

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin installed
    • Dart plugin version 202.7319.5

[✓] Connected device (2 available)
    • sdk gphone x86 arm (mobile) • emulator-5554                        • android-x86 • Android 11 (API 30) (emulator)
    • iPhone 11 Pro (mobile)      • B0415B3C-2E75-4FA5-85E4-425082E20A87 • ios         • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
    ! Error: Tara’s iPhone is not connected. Xcode will continue when Tara’s iPhone is connected. (code -13)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:26 (12 by maintainers)

github_iconTop GitHub Comments

54reactions
hoonjicommented, Dec 27, 2020

Opening Android Studio from the terminal worked for me: open /Applications/Android\ Studio.app

The issue is caused by PATH is not being set correctly when opening Android Studio from GUI - in particular it does not seem to include /usr/local/bin, which is why the which pod command is not found during flutter run.

Originally mentioned here: https://github.com/flutter/flutter/issues/54962#issuecomment-672578610

1reaction
AlexanderThielecommented, May 2, 2022

just leaving my 2 cents: I updated Android Studio to 2021.1.1 Patch 3 which fixed the issue for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Studio doesn't recognize cocoapods - Stack Overflow
Try opening Android Studio from the terminal open /Applications/Android\ Studio.app. This seems to fix the PATH issue causing the CocoaPods ...
Read more >
[Solved]-Android Studio doesn't recognize cocoapods-Flutter
Try opening Android Studio from the terminal open /Applications/Android\ Studio.app. This seems to fix the PATH issue causing the CocoaPods not installed ...
Read more >
CocoaPods not installed or not in valid state ... - YouTube
CocoaPods not installed or not in valid state # Flutter # AndroidStudio #IntelliJIDEA #VisualStudioLaunching lib/main.dart on iPhone 12 Pro ...
Read more >
flutter cocoapods not installed. skipping pod install - You.com
I had this same error a number of times in the past, and once right after I upgraded to Flutter 2.0.1 just now....
Read more >
Flutter error: "CocoaPods not installed or not in valid state."
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/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found