I encounter this error when i try to build for ios, i tried every solution i could find online
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from
/Users/ahmedaly/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.13/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/ahmedaly/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.13/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal
error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
Encountered error while building for device.
example of the things i tried:
pod deintegrate
rm podfile.lock
rm pubspec.lock
flutter clean
flutter run
and just about anything similar you could immagine
i also tried removing the file from the path indicated and removing the dependency from pubspec.yaml but it didn’t work
flutter doctor output :
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.0, on macOS 11.6 20G165 darwin-x64, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2021.2.3)
[✓] VS Code (version 1.63.0)
[✓] Connected device (2 available)
• No issues found!
I found a solution in another question on Stack!
Backup ios/Runner folder.
Delete the ios folder.
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).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
If flutter run fails:
cd ios
pod install
cd ..
flutter run
Related
Xcode's output: ↳
In file included from /Users/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.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/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.m:5:
/Users/dani/development/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
flutter doctor:
[✓] Flutter (Channel stable, 2.0.5, on macOS 11.2.3 20D91
darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android
SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (3 available)
• No issues found!
I tried all solutions proposed here without luck:
https://github.com/flutter/flutter/issues/16036
All dependencies updated
This is a matter of finding a library on our app that doesn't support null safety. We can do several things after identify it:
Ask on its repo to get support for null safety
Use a different library that supports this
Try to fix it ourselves
stackoverflow.com/a/33509278/4858133
I believe you should try both of this steps:
1- Try to remove pod files and install them again by executing:
$ cd ios/
$ pod deintegrate
$ pod install
2- Clean workplace by executing command on the root of the project:
$ flutter clean
Then try to run the app again.
I already tried all of this link and nothing
Xcode build done. 4,3s
Failed to build iOS app
Error output from Xcode build:
↳
objc[22045]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1ffbaf8f0) and ?? (0x11b1602b8). One of the two will be used. Which one is undefined.
objc[22045]: Class AMSupportURLSession is implemented in both ?? (0x1ffbaf940) and ?? (0x11b160308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/netolobo/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.28/ios/Classes/FLTPathProviderPlugin.m:5:
/Users/netolobo/development/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.28/ios/Classes/FLTPathProviderPlugin.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.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 2.1.0-13.0.pre.499, on macOS 11.1 20C69 darwin-arm, locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (2 available)
• No issues found!
I finally found the final solution!
Backup ios/Runner folder.
Delete the ios folder.
Run flutter create . in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
I just found out that I can change my flutter app to a website without writing external code. I decided to test it on my app but I got this error and I have no idea how to fix it. I followed the steps on the "website" but still I get the error. My stacktrace is :-
This application is not configured to build on the web.
To add web support to a project, run `flutter create .`.
Launching lib\main.dart on Web Server in debug mode...
Syncing files to device Web Server...
org-dartlang-app:/web_entrypoint.dart:8:8: Error: Error when reading 'lib/generated_plugin_registrant.dart': The system cannot find the file specified.
import 'package:discountapp/generated_plugin_registrant.dart';
^
org-dartlang-app:/web_entrypoint.dart:11:3: Error: Method not found: 'registerPlugins'.
registerPlugins(webPluginRegistry);
^^^^^^^^^^^^^^^
Failed to compile application.
I run flutter create . and it says
C:\Users\Hemant\AndroidStudioProjects\discountapp\ios>flutter create .
Recreating project ....
Wrote 3 files.
All done!
[√] Flutter: is fully installed. (Channel beta, 1.20.0-7.2.pre, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Chrome - develop for the web: is fully installed.
[√] Android Studio: is fully installed. (version 4.0)
[√] Connected device: is fully installed. (3 available)
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in .\lib\main.dart.
C:\Users\Hemant\AndroidStudioProjects\discountapp\ios>flutter create .
Recreating project ....
Wrote 3 files.
All done!
[√] Flutter: is fully installed. (Channel beta, 1.20.0-7.2.pre, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Chrome - develop for the web: is fully installed.
[√] Android Studio: is fully installed. (version 4.0)
[√] Connected device: is fully installed. (3 available)
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in .\lib\main.dart.
Running flutter run will run it on my phone. I will provide any code needed. Please help
You have to run flutter create . in application's root folder, but not in ios subfolder.
Rename ios folder to _ios
Run this command in your Terminal: flutter create --platforms=web .
Rename back _ios folder to ios
This will write all needed files to run your app on the browser.
I'm developing a Flutter plugin that was running until a minute ago.
I haven't changed my Flutter project or the generated Xcode workspace at all. But all of a sudden the iOS Runner build breaks:
/path/to/myplugin/example/ios/Runner/GeneratedPluginRegistrant.m:10:9:
fatal error: module 'nativeguest' not found
#import myplugin;
~~~~~~~^~~~~~~~~~~
1 error generated.
I haven't renamed or moved anything so I have no clue where this came from. I double checked there are no changes through my Git history.
I don't quite remember what happened except a few flutter clean and flutter run -d <udid> ops. I probably did these in both the plugin example folder and the plugin root folder.
My Flutter global setup is perfectly fine
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, 1.19.0-1.0.pre, on Mac OS X 10.15.4 19E287, locale en-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.45.1)
[✓] Connected device (2 available)
• No issues found!
This turned out to be a Bundle ID issue. I renamed the bundle on flutter side in the .yaml, but the new name didn't reflect back to the Xcode project.
One must manually rename the following metadata entries of the generated Xcode Runner project
Runner > Runner > Info.plist: Bundle name
`Runner > Main Editor: Signing & Capabilities > Bundle Identifier
IMHO, this is such a bad dev experience on flutter part. Renaming on Android is another roller-coaster ride of having to edit multiple manifests and Gradle configs.
Due to so many separate config files, renaming or any project reorganization becomes such a risky act!
I can't build on iOS Simulator when using firebase_admob Plugin.
I can build on Android.
console log:
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/rkowase/StudioProjects/stopwatch/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'firebase_admob/FirebaseAdMobPlugin.h' file not found
#import <firebase_admob/FirebaseAdMobPlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.
flutter doctor
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.12.6 16G1114, locale en-JP)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] Connected devices (2 available)
• No issues found!
pubspec.yaml
dependencies:
flutter:
sdk: flutter
firebase_admob:
I use firebase_admob v0.5.0
https://pub.dartlang.org/packages/firebase_admob
Sample code
https://github.com/rkowase/flutter-firebase-admob-sample
I solved it by doing this workaround.
Links
"Made Podfiles use symlinks to local pods" not working · Issue #15099 · flutter/flutter
https://github.com/flutter/flutter/issues/15099
objective c - Swift compiler error: "non-modular header inside framework module" - Stack Overflow
Swift compiler error: "non-modular header inside framework module"
PathProvider not found on iOS build - Google Groups
https://groups.google.com/forum/#!msg/flutter-dev/7QRk1RphLDE/5rLS4CciBwAJ