Flutter ios : camera/CameraPlugin.h' file not found - ios

Created Flutter application built on both an Android and iOS device. Application is working fine with android and when i build my ios build it ends up with error as shown below.
Error while executing ios build in android studio using mac device.
i try plenty of method to solve this.
**FOLLOWED SETS:**
Flutter clean
Flutter pub get
Pod install
Build.
Output
Launching lib/main.dart on iPad in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 3MDPB894U7
Running pod install...
Running Xcode build...
Xcode build done. 52.7s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/apple/AndroidStudioProjects/console/ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'camera' not found
#import camera;
~~~~~~~^~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
Error launching application on iPad.

Change the target version to above 10.0.
Change in the Project Runner (in Xcode), PodFile & Target Runner (in Xcode), then run Pod Install

Make sure you open the .xcworkspace file instead of the .xcodeproj. This helped me to solve the issue.

Related

flutter build ios --release fatal error: module 'add_2_calendar' not found

I want to make a release for my project who work perefctly in dev mode.
When I make only flutter ios build it works fine
but flutter build ios --release doesn't work
the error message
youssefdahar#MacBook-Pro-van-Youssef devs % flutter build ios --release
Building com.example.mental for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: X6BX32XBYP
Running pod install... 1 022ms
Running Xcode build...
└─Compiling, linking and signing... 1 163ms
Xcode build done. 47,6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/n7/4j0kgb856bl9z75hy71rfmj80000gn/T/flutter_tools.TVo200/flutter_ios_build_temp_dirNtfcgE/temporary_xcresult_bundle
/Users/youssefdahar/devs/ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'add_2_calendar' not found
#import add_2_calendar;
~~~~~~~^~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/n7/4j0kgb856bl9z75hy71rfmj80000gn/T/flutter_tools.TVo200/flutter_ios_build_temp_dirNtfcgE/temporary_xcresult_bundle
It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
open ios/Runner.xcworkspace
Encountered error while building for device.
I saw in the in the internet that i have to clean project and pod folder and file and reinstall, i tried many times but in vain
thanks in advance for your help
Finally I figured out that pod init and install doesn't work correctly because the file podfile generate by pod init is not the same as podfile generated by flutter run.
The solution is I deleted all pod file and folder and lock and ran flutter run once

Flutter IOS Architecture Issue in M1 Mac using VS code

I am using an M1 MacBook pro laptop and ios 13 simulator for developing a flutter app, But I am getting the below issue while trying to run the flutter app in the emulator.
This started happening when I upgraded my workspace to Flutter 2.8.
No problem while running in Android.
Please advise how to resolve this issue.
Kindly do not advise me to do the development in Xcode. I am not familiar and do not have enough bandwidth to learn new IDE. I am using VSCODE.
Launching lib/main.dart on iPhone 13 in debug mode...
lib/main.dart:1
Updating project for Xcode compatibility.
Upgrading Runner.xcscheme
Xcode build done. 1.5s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
/Users/path/to/flutter/project/projectname/ios/Runner.xcodeproj: error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: x86_64.
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)
Specify one more architecture for m1 chip.
Runner > Build Settings > Excluded Architecture > Add arm64
This solution worked for me.

Flutter build iOS FAILED

I build a new flutter project from VSCode, and run on iOS simulator (iphone 11), it shows:
Launching lib/main.dart on iPhone 11 in debug mode...
Xcode build done. 11.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: unable to spawn process (No such file or directory) (in target 'Runner' from project 'Runner')
error: unable to spawn process (No such file or directory) (in target 'Runner' from project 'Runner')
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11.
Exited (sigterm)
Follow the below steps.
Open your Flutter project folder, in my case - helloflutter find the iOS folder and open that folder
Inside the "iOS" folder open Rinner.xcworkspace in your Xcode IDE
Once Xcode open go to Signin & Capabilities (fallow the sequence to reach Signin & Capabilities from below image)
Uncheck checkbox that Automatically manage signing from Signin & Capabilities
5. Save the changes, close Xcode, and run the Flutter code once again.

Can't build for release - Flutter, Xcode

I have built a couple of Flutter apps using IntelliJ and xcode on a Mac server to build for ios release, and it has worked fine. Now I am suddenly having troubles building for release.
To test to see if it was something in my app, I just started a new app from scratch in IntelliJ on the server, configured the framework (including directing to the flutter install), and tested it out.
It builds and runs on the simulator just fine. But when I try to build for release ("flutter build ios" from command line) I get an error, which I will paste at the end of this message.
I have been trying for some time to figure out why I am getting the errors when building my app. Now even the default app seems broken.
Does the problem have something to do with the server?
Thank you.
The error message that I get when building for release (I gave the project a silly name, added an icon, and gave the app a build and version number, but otherwise it is an untouched flutter default app):
74-80-250-218:untitled userxxxxx$ flutter build ios
Building com.burrito.untitled for device (ios-release)...
Automatically signing iOS for device deployment using specified development team
in Xcode project: xxxxxxxxxx
Running Xcode build...
├─Building Dart code... 22.7s
├─Generating dSYM file... 0.2s
├─Stripping debug symbols... 0.0s
├─Assembling Flutter resources... 1.2s
└─Compiling, linking and signing... 0.2s
Xcode build done. 26.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from
/Users/userxxxxxx/Desktop/untitled/ios/Runner/GeneratedPluginRegistrant.m:5:
/Users/userxxxxxx/Desktop/untitled/ios/Runner/GeneratedPluginRegistrant.h:8:
9: fatal error: 'Flutter/Flutter.h' file not found
#import
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from
/Users/userxxxxx/Desktop/untitled/ios/Runner/GeneratedPluginRegistrant.m:5:
/Users/userxxxxxx/Desktop/untitled/ios/Runner/GeneratedPluginRegistrant.h:8:
9: fatal error: 'Flutter/Flutter.h' file not found
#import
^~~~~~~~~~~~~~~~~~~
1 error generated.
Encountered error while building for device.
You could try deleting the ios folder on the project and generate an iOS build again by running flutter create --platforms=ios [PROJECT_PATH]. That should generate an iOS project from your Flutter code. After that, run flutter build ios again.

Flutter failed to build sample iOS app on VS Code

I'm trying to build the Flutter sample project on VS code, but got this messages... The sample is building and running fine on Android device, and I also tried running the sample with Android Studio on iOS simulator which is also fine. It just doesn't work on VS Code. Has anyone meet the same issue?
Flutter: v0.2.2
Launching lib/main.dart on iPhone 8 in debug mode...
Xcode build done
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/Sean/Documents/myapp/build/ios/Debug-iphonesimulator/Runner.app:resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
Could not build the application for the simulator.
Error launching application on iPhone 8.
Exited (sigterm)
This is a new security measure in the Xcode build system.
You can go into details here : https://stackoverflow.com/a/39667628/6622328
For a quick fix, just clean the app before rebuilding it (flutter clean).
I suspect you don't have XCode installed, or have enabled your Runner project for your developer ID.

Resources