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.