Module 'path_provider' not found

Viewed 5305

I have used several times the Xcode simulator for my flutter app. One time I tried to change the simulator to iPhone 11 Pro (don't know if it did or did not cause the problem) but since then:

  1. I get the error Module 'path_provider' not found.
  2. It seems that each time when I double click on the Runner.xcworkspace file, it opens the project file instead. I'm new to Xcode so not quite sure about that but I attached a screenshot.

Things I've tried:

  • updated according to the instructions in the warnings (which can be seen in the screenshot).
  • deleted all Xcode cache with Reset Xcode
  • deleted the android studio project and popped it again from git.
  • flutter clean + removed all the pod files + pod install from android studio terminal. according to the explanations here: reinstall pod

What else can I do?

enter image description here

6 Answers

I had the same issue. All I had to do was open the runner.xcworkspace instead of runner.xcodeproj and run the app.

I faced this same error and realized that I have used pod init manually so I deleted the Podfile in the ios folder then run flutter build ios. The Flutter will generate the Podfile correctly and everything works well after that.

The problem for me, as it seems, was that the Xcode opened "Runner.xcodeproj" instead of "Runner.xcworkspace" from what I understood, .xcworkspace is the one that makes the bindings/connections between files and packages. xcodeproj doesn't do it and that's why it was missin although I did have it.

Solution: To be sure I do have the updated version of the missing package:

  1. cd [project path]
  2. Flutter clean (or delete the build folder to ensure there is no cache)
  3. cd [project path]/ios
  4. pod install
  5. pod update

Then, when opening the Xcode I clicked: Project navigator (folder icon on the left toolbar) -> Runner (in the project tree that opened) -> Runner (under Targets) (shown in the attached picture)

and then when I build it worked for me.

enter image description here

In Podfile, I just comment platform :ios, '11.0', it worked!

I had the same problem that was caused by the linker. I solved it as follows: runner->build setting->other linker flags, and delete path_provider

My technique is basically to rip it up and start again - keeping all the lib files though! That way you can keep track of what you need to do to fix the things you broke trying to fix it earlier !

I create a new flutter project and add the lib files from the broken project. then piece by piece put it back together. I decided on this idea after trawling through many 'patches' to the specific errors that I saw. I should not have been anywhere near those errors - so patching them just broke more - untraceably. Hence the rebuild.

Related