Skip to content

Improve the error if plugins require CocoaPods but CocoaPods is not installed #163284

@sethladd

Description

@sethladd

Steps to reproduce

Start the simulator
flutter create
paste in this gist: https://gist.githubusercontent.com/MaherSafadii/5bcd5848cd24442c8c91b1ef173ba73d/raw/0507e4fdfcdb2fc7136edd6c327ae20765b601ab/flutter_cupertino_example.dart
Add in the missing packages to your pubspec.yaml (native_ios_dialog and pull_down_button)
flutter run

Expected results

Assuming I don't need any cocoapods installs, then I would expect this to run on my simulator.

If my project does contain a plugin (which I would then assume I need cocoapods), then the expected results would be something like:

"Unable to launch application on iPhone 16 Pro. Reason: CocoaPods not installed. Your project requires CocoaPods because of packages X and Y. Please follow instructions x.y to install CocoaPods and try again."

What is a bit surprising about the current Actual results is that it leads with a "Warning: " which often means "Just to let you know...". However, the flutter run fails (errors) , which seems to not match the "Warning". Also, it would be awesome if we can point the user to which package(s) require CocoaPods.

It's not 100% clear to me given the Actual Results... do I need to go get CocoaPods to run my app? If so, why?

Actual results

sethladd@LexicalM4 flutter_cupertino % flutter run
Launching lib/main.dart on iPhone 16 Pro in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
  CocoaPods is a package manager for iOS or macOS platform code.
  Without CocoaPods, plugins will not work on iOS or macOS.
  For more info, see https://flutter.dev/to/platform-plugins
For installation instructions, see
https://guides.cocoapods.org/using/getting-started.html#installation



CocoaPods not installed or not in valid state.
Error launching application on iPhone 16 Pro.

Code sample

See steps to repro

Screenshots or Video

See Actual Results

Logs

N/A (the Actual Results is everything)

Flutter Doctor output

Doctor output
sethladd@LexicalM4 flutter_cupertino % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.4, on macOS 15.3 24D60 darwin-arm64, locale
    en-US)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.dev/to/macos-android-setup for detailed
      instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[!] Xcode - develop for iOS and macOS (Xcode 16.2)
    ✗ CocoaPods not installed.
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      For installation instructions, see
      https://guides.cocoapods.org/using/getting-started.html#installation
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 3 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listplatform-iosiOS applications specificallyplatform-macBuilding on or for macOS specificallyteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions