184

I don't know why but I can't build or run the App in my new Macbook, I run the same folder on another Mac or my windows computer and runs perfectly. here when I run flutter clean, I have to run pub get to solve the issues, Is that normal?

If I create a new project, I can run flutter run normally, so I think that maybe there I think it may be related to plugins.

Do you know how can I solve this? Thanks

Flutter Doctor [✓] Flutter (Channel master, 1.24.0-8.0.pre.343, on macOS 11.0.1 20B29 darwin-x64, locale es-419) • Flutter version 1.24.0-8.0.pre.343 at /Users/leo/tools/flutter • Framework revision cf6c33e58a (2 days ago), 2020-11-21 14:04:01 -0800 • Engine revision 23a8e027db • Dart version 2.12.0 (build 2.12.0-62.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/leo/Library/Android/sdk • Platform android-30, build-tools 30.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 12.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.2, Build version 12B45b • CocoaPods version 1.9.3 [✓] Android Studio (version 4.1) • 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 1.8.0_242-release-1644-b3-6915495) [✓] Connected device (2 available) • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • iPhone 12 Pro Max (mobile) • F768139D-7B87-4D9E-93B8-14C7D63786B0 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator) • No issues found! Launching lib/main.dart on iPhone 12 Pro Max in debug mode... Running Xcode build... Xcode build done. 11.4s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED ** Xcode's output: ↳ <module-includes>:1:9: note: in file included from <module-includes>:1: #import "Headers/vibration-umbrella.h" ^ /Users/leo/Apps/previate_esta/ios/Pods/Target Support Files/vibration/vibration-umbrella.h:13:9: note: in file included from /Users/leo/Apps/previate_esta/ios/Pods/Target Support Files/vibration/vibration-umbrella.h:13: #import "VibrationPlugin.h" ^ /Users/leo/.pub-cache/hosted/pub.dartlang.org/vibration-1.4.0/ios/Classes/VibrationPlugin.h:1:9: error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^ <unknown>:0: error: could not build Objective-C module 'vibration' In file included from /Users/leo/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.3/ios/Classes/FLTURLLauncherPlugin.m:7: /Users/leo/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.3/ios/Classes/FLTURLLauncherPlugin.h:5:9 : fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 1 error generated. In file included from /Users/leo/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreference sPlugin.m:5: /Users/leo/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreference sPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 1 error generated. In file included from /Users/leo/.pub-cache/hosted/pub.dartlang.org/share-0.6.5/ios/Classes/FLTSharePlugin.m:5: /Users/leo/.pub-cache/hosted/pub.dartlang.org/share-0.6.5/ios/Classes/FLTSharePlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 1 error generated. In file included from /Users/leo/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.2+4/ios/Classes/FLTSensorsPlugin.m:5: /Users/leo/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.2+4/ios/Classes/FLTSensorsPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 1 error generated. note: Using new build system note: Building targets in parallel note: Planning build note: Constructing build description Could not build the application for the simulator. Error launching application on iPhone 12 Pro Max. 
4
  • 2
    For someone in 2021 facing this issue, here is the solution that worked for me https://stackoverflow.com/a/67110794/8647537 Commented Apr 15, 2021 at 14:57
  • I found a simple solution. stackoverflow.com/questions/64973346/… It saves your time Commented Aug 6, 2022 at 1:37
  • In my case all i have to is adding " pod 'Firebase/Core' " in my podfile. flutter_ios_podfile_setup target 'Runner' do use_frameworks! use_modular_headers! pod 'Firebase/Core' flutter_install_all_ios_pods File.dirname(File.realpath(FILE)) end Commented Nov 14, 2023 at 8:02
  • I found a simple solution. stackoverflow.com/questions/64973346/… It saves your time – dokind. great ans its worked.. but still take first backup Commented Aug 27 at 7:36

43 Answers 43

1
2
1

1-Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).

2-uncomment #platform :ios, '9.0' in the Podfile - i set that '10.0'

3-pod repo update

4-pod install

Sign up to request clarification or add additional context in comments.

Comments

1

Flutter version on my mac was higher than the flutter version where I coded the application on… So I just downgraded my flutter to the version I coded on And tada Error resolved Make sure you are on the same version of flutter as the laptop you coded on In my case I coded it on old version of flutter on my windows laptop and tired to run on latest version of flutter so the error popped up. If this is your case then go through the below link - Flutter simulator error: Command PhaseScriptExecution failed with a nonzero exit code

Comments

1

If you only encounter this problem when running "flutter build ipa", in XCode make sure your Deployment Info under Runner and Pods matches the 'platform' in ios/Podfile.

Podfile

Runner

Comments

1

This happened me too. After follow below steps problem sorted for me !

  1. Back up the Runner folder in your ios folder to a safe place.
  2. Delete the ios folder:
  3. Go to the root directory, run the following command:

flutter create .

  1. After above step, will create ios folder. Copy and paste the Runner folder you have backed up before to the new ios folder:
  2. Run the project in android studio or VS code
  3. Navigate to your ios folder and run:

pod install

  1. ios > Runner.xcworkspace right click and Flutter > Open iOS module in xCode enter image description here

It will work :)

Comments

1
  1. Copy info.plist, Assets.xcassets and other important files.
  2. Create a New project with same name and bundle id.
  3. Add an iOS project in your old project and add 1st step information in that.
  4. Run project. It's working now.

Comments

1

I found a simple solution. just in case save backup :)

  1. rm -rf ios
  2. flutter create -i swift .

That's it.

Comments

1

In my case I had modified my Run Script (in Targets - Runner - Build Phases) to add Crashlytics. Actually we should create a new Run Script for Crashlytics. My answer should also work for those who removed or mispositioned their Run Script:

enter image description here

Make sure the Run Script is between Check Pods Manifest.lock and Compile Sources :
the contents of the script should be :

 /bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build 

inside the Shell (/bin/sh).

While writing this answer, the Run Script for the latest version of Crashlytics should be at the last.

Comments

0

A really simple solution that worked for me was simply: close the xcode project. Then, on Android Studio, build the iOS archive by going to Build -> Flutter -> Build iOS. Then reopen the xcode project and it built and ran fine.

Comments

0

The error "No such module 'Flutter'" typically occurs when the Flutter framework is not properly linked or recognized by your iOS project. This can happen for several reasons, such as a corrupted installation or issues with the project configuration.

To resolve this error, you can simply reinstall Flutter. Here are the steps to do that:

  1. Uninstall Flutter:
  • Delete the Flutter SDK folder from your system.
  1. Download the Latest Flutter SDK:
  • Go to the official Flutter website: flutter.dev.
  • Download the latest stable version of the Flutter SDK for your operating system.
  1. Extract and Set Up Flutter:
  • Extract the downloaded file to your desired location.
  • Add the Flutter bin directory to your system's PATH.
  1. Run Flutter Doctor:
  • Open a terminal and run flutter doctor to check for any issues and make sure everything is set up correctly.
  1. Reopen Your Project: Open your Flutter project in your IDE (like Xcode or Android Studio) and ensure that the project is configured to use the newly installed Flutter SDK.

By following these steps, you should resolve the "No such module 'Flutter'" error and be able to build your project successfully.

Comments

0

worked for me;

Xcode => Runner => Build Settings and put "Allow Non-modular Includes In Framework Modules" to "yes"

Comments

0

I spent some time on this. It turned out the problem was the order of some statements in the podfile -> post_install do |installer|

Specifically

flutter_additional_macos_build_settings(target) 

MUST come last and not first.

Here is that working section in my podfile. The first 2 loops are specific to libraries I am using in my project, but notice I put the statement added by Flutter last:

post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'webcrypto' target.source_build_phase.files.each do |file| if file.settings && file.settings['COMPILER_FLAGS'] flags = file.settings['COMPILER_FLAGS'].split flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' } file.settings['COMPILER_FLAGS'] = flags.join(' ') end end end if target.name == 'webcrypto' || target.name == 'super_native_extensions' || target.name == 'printing' || target.name == 'irondash_engine_context' || target.name == 'cryptography_flutter' || target.name == 'PromisesObjC-FBLPromises_Privacy' || target.name == 'PromisesObjC' target.build_configurations.each do |config| config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '12.4' end end #This MUST come last otherwise the build will fail with 'FlutterMacOS/FlutterMacOS.h' file not found flutter_additional_macos_build_settings(target) end end 

If this was your problem then update your podfile, delete the Pods directory and the podfile.lock file, then run flutter pub get and rebuild. Good luck.

Comments

-1
flutter pub cache repair 

this worked for meenter image description here

1 Comment

Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. - From Review
-4

Downgrade flutter to 1.22.6 (any version below 2.0.0)

Option 1

flutter downgrade v1.22.6

After this, run any Flutter command (such as flutter doctor), and Flutter will take care of downloading/compiling everything required to run this version.

Option 2

You can also download other versions of Flutter SDK from here

1 Comment

It's not a SDK related problem
1
2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.