Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter shared_preferences module not found - iOS Xcode build

I am using shared_preferences dependency in Flutter.

Building Xcode (Product->archive - for Generic target) fails with

module 'shared_preferences' not found

Build in Xcode fails

I tried flutter clean, flutter pub cache repair, tried moving Flutter lib/ into new project (flutter create .) and I building using older Xcode version (11.4.1)..currently I have 12.0 beta 3.

What is weird is that running in Emulator from my IDE (IntelliJ) works just fine with no errors.

IDE Emulator dart main runs OK

These are my dependencies (pubspec.yaml)

dependencies:
  flutter:
    sdk: flutter
  http: ^0.12.2
  intl: any
  flutter_spinkit: ^4.1.2
  redux: any
  flutter_redux: any
  redux_thunk: any
  shared_preferences: 0.5.1+2
like image 364
Xquick Avatar asked Jul 29 '20 14:07

Xquick


People also ask

Why is my Firebase activity not showing up in Xcode?

If you run the program through Xcode, make sure that you have opened the Runner.xcworkspace file in XCode, not the Runner.xcodeproj file Show activity on this post. in my case, it was an issue with the firebase, firestore document. just make sure to update all libraries, like firebasecore, firebaseauth, analytics, etc to the latest version.

Why can't I see activity in Xcode?

If you run the program through Xcode, make sure that you have opened the Runner.xcworkspace file in XCode, not the Runner.xcodeproj file Show activity on this post.

Can I use Kotlin with IntelliJ flutter?

I have just created a new flutter application in Intellij and I chose to use Kotlin for the Android part and Swift for the iOS part. I also included shared preferences plugin ver.0.4.0 in the project. I run my application on Android and everything works fine, but on iOS I get error and the build fails.


3 Answers

In my case problem was that I was opening Xcode project from Project.xcodeproj instead of Project.xcworkspace.

like image 63
Xquick Avatar answered Oct 19 '22 00:10

Xquick


I had to change the scheme in the following manner:

Product -> Scheme -> Edit Scheme

enter image description here

like image 1
E.Bradford Avatar answered Oct 18 '22 23:10

E.Bradford


Searching on Stack Overflow I found this Flutter module not found in Xcode Which links to this https://github.com/flutter/flutter/issues/54599#issuecomment-644336055

This solved it for me!

enter image description here

like image 1
Justin Torre Avatar answered Oct 18 '22 23:10

Justin Torre