Flutter - Warning (CocoaPods not installed Skipping pod install) Even While Installed
Asked Answered
R

14

18

I am trying to build a Flutter app with Geolocator plugin on Android Studio. When I am running the app I have the following warning - that prevents the app from running:

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 tried every solution i found in the internet (Stackoverflow & GitHub) but nothing seems to work.

Important: When I tried to run the app from Xcode instead of from Android Studio, I had this error:

The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

So what I did was - Change directory to ios (on the Flutter project) and running:

pod init
pod install

Tried to run again from Xcode and it worked perfectly. After it works on Xcode I tried to run it from Android Studio and the same error happens to me, preventing the app to launch.

Flutter Doctor:

[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-IL)
    • Flutter version 2.2.2 at /Users/idanrefaeli/Developer/flutter
    • Framework revision d79295af24 (5 weeks ago), 2021-06-11 08:56:01 -0700
    • Engine revision 91c9fc8fe0
    • Dart version 2.13.3

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/idanrefaeli/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.57.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (2 available)
    • Idan’s (mobile) • 00008020-0011092101A2002E • ios            • iOS 14.6
    • Chrome (web)    • chrome                    • web-javascript • Google Chrome 91.0.4472.114

! Doctor found issues in 1 category.

Extra logs: 'Run' log in Android Studio: pastebin.com/7iYtdcTQ Also this terminal log after running 'pod install': pastebin.com/1cCNuFYM

-- UPDATE --

I finally was able to run the app, all I did was to copy all the project files to a new project from scratch and it worked. Maybe some conflict caused this issue, it was my last resort of course.

Ress answered 19/7, 2021 at 19:45 Comment(5)
I had the same problem using VS Code, but it was resolved when I reopened it.Melson
I tried reopening, restarting, flutter clean, everythingRess
Show us the complete error (print) please. I'm trying to reproduce it.Melson
Here: pastebin.com/7iYtdcTQ Also this terminal log after running 'pod install': pastebin.com/1cCNuFYMRess
The same problem((Whoredom
A
32

In the app Terminal after open Simulator write

flutter run

in the Terminal

or close Android Studio and open terminal and paste

open /Applications/Android\ Studio.app 

it will open the Android Studio and you can run as normal

Antonetta answered 27/1, 2022 at 9:23 Comment(4)
this: open /Applications/Android\ Studio.app worked for meListen
This one really helps, no need to install the patch 1 for Android Studio Bumblebee, just run open /Applications/Android\ Studio.appConnaught
Quit the android studio and execute open /Applications/Android\ Studio.app in terminal. started working !Unrivaled
open /Applications/Android\ Studio.app works like charm, thanks!Panoptic
P
19
# uninstall
sudo gem uninstall cocoapods
brew uninstall cocoapods

# reinstall
sudo gem install cocoapods
pod setup

# rebuild
flutter build ios

Then, restart vscode and iTerm (it is important), and debug

Pompea answered 8/2, 2022 at 7:16 Comment(2)
Finally fixed my issue using these commands +1Phytobiology
most complete and simple answer. +1Timberhead
B
11

This error started appearing in mac os after the update

Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.0.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: com.bloc.intellij_generator_plugin (3.3.0), Dart (211.7798), andrasferenczi.dart-data-plugin (0.2.0), com.thoughtworks.gauge (211.6693.111), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), io.flutter (63.2.2), org.intellij.plugins.markdown (211.7142.37)

In my case, it is working to launch project in vs code, or running project with command flutter run

Android Canary last version solved problem

Update: As Ascot Harris mentioned, Android Studio Bumblebee | 2021.1.1 Patch 1 solves problem

Bes answered 1/2, 2022 at 11:40 Comment(2)
Android Canary is a good solution for now, thanksFrasch
Android Studio Bumblebee | 2021.1.1 Patch 1 solved the issue for meYellowtail
L
6

STEP 1: close Android Studio

STEP 2: open terminal

STEP 3: paste:

open /Applications/Android\ Studio.app

STEP 4: Android Studio will be opened auto.

STEP 5: click run button

Larios answered 26/8, 2022 at 20:32 Comment(0)
P
4

just open terminal and write

sudo gem install cocoapods

this solve problem in my case

Psychotherapy answered 16/2, 2022 at 21:8 Comment(0)
M
3

I had the same problem and I installed cocoapods and it works now.

Just copy and paste this line to install cocoapods: sudo gem install cocoapods

Restart VSCode and terminals.

And then run your app.

I'm working on MAC with IOS (Iphone 13) emulator.

CocoaPods Guide.

Mineraloid answered 9/2, 2022 at 14:59 Comment(0)
N
3

first of all you should do this command below:

sudo gem install activesupport -v 6.1.7.6

then:

sudo gem install cocoapods  
Neapolitan answered 13/9, 2023 at 22:44 Comment(0)
M
1

This is solved by deleting

Podfile.lock pods folder

updating these packages

firebase_core: ^1.12.0
firebase_analytics: ^8.3.4
firebase_crashlytics: ^2.3.0.
firebase_messaging: ^11.1.0.

then running first

pod repo remove trunk

and finally

pod install
Mims answered 29/11, 2022 at 18:37 Comment(0)
W
1

for me closing and reopening the VS code fixed the problem.

Wader answered 16/8, 2023 at 9:22 Comment(1)
wow this fixed it for me as well, thanks!Sandlin
S
0

This is a horrible hack, which sometimes works.

I run the app from Visual Studio code once and the subsequent run in Android Studio work

Stopper answered 30/1, 2022 at 13:28 Comment(0)
T
0

As @islomkhuja-akhrarov mentioned it's an Android Studio Bumblebee problem, installing patch 1 helped

Truthvalue answered 7/2, 2022 at 4:46 Comment(0)
V
0

I could resolve my case by restarting with Invalid Caches in Android Studio.

enter image description here

If you can't resolve to do the above you can try to do the below.

  1. Delete Xcode caches
rm -rf ~/Library/Caches/com.apple.dt.Xcode/
  1. Delete intermediate files
rm -rf ~/Library/Developer/Xcode/DerivedData/
Varela answered 29/7 at 6:28 Comment(0)
K
0

I guess that the fault lies among these particular dependencies on ios side:

firebase_core:
firebase_messaging:

My setup: MacBook Pro, M2, 2022. VS Code IDE. Flutter 3.19.0, cocoapods 1.15, ios simulator running ios 17.5

Solution

  1. In the Flutter project folder, delete podfile.lock and Pods folder, both of these are present inside ios folder.

  2. Open a terminal window(not in the IDE) and run this command:

    brew install cocoapods

    It runs many downloads for a while (20 minutes in my case).

  3. From the same terminal run:

    pod setup

  4. Now go to the Flutter project folder, open a terminal in it, and run the following commands (not necessarily in a chain):

    flutter clean && flutter pub get && cd ios && pod repo remove trunk && pod install && pod repo update && cd .. && exit

After doing the steps above, I still got the same error during the build. I got frustrated, force-closed every open window/app, and rebooted the system.

I took a break and ran the project again, and the error no longer appeared.

I can't pinpoint it, but something above definitely worked.

Kurtzig answered 3/8 at 16:26 Comment(0)
C
-1

It can also be the case if your updating the xcode so wait till the installation complete

Caerleon answered 29/3, 2022 at 7:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.