Flutter will not build on iOS with Firebase on M1 Mac - ios

I keep trying to build my Flutter app on iOS but I keep getting an error. I have tried everything. I imported my project from GitHub, where I uploaded it from Windows.
I followed every step, and I added the iOS app on Firebase and now when wanting to compile I am unable, and very frustrated. Please help.
objc[7346]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x20d9f4188) and ?? (0x113d402b8). One of the two will be
used. Which one is undefined.
objc[7346]: Class AMSupportURLSession is implemented in both ?? (0x20d9f41d8) and ?? (0x113d40308). One of the two will be used. Which one
is undefined.
** BUILD FAILED **
Xcode's output:
↳
/Users/davor/Developer/Projects/Explovid/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'cloud_firestore' not found
#import cloud_firestore;
~~~~~~~^~~~~~~~~~~~~~~
1 error generated.
error: the following command failed with exit code 1 but produced no further output
CompileC
/Users/davor/Library/Developer/Xcode/DerivedData/Runner-cnftrifzvgjcpyadycxyixuvtnnj/Build/Intermediates.noindex/Runner.build/Release-ipho
neos/Runner.build/Objects-normal/arm64/GeneratedPluginRegistrant.o
/Users/davor/Developer/Projects/Explovid/ios/Runner/GeneratedPluginRegistrant.m normal arm64 objective-c
com.apple.compilers.llvm.clang.1_0.compiler
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.

I had the same issue. Installed ffi and fixed:
arch -x86_64 sudo gem install ffi

best answer i found that works is URL below...I found all sorts of issues with M1 ... need to ensure you run from terminal with rosetta ticket in "get info" dialogue box. Its convoluted process.
https://github.com/GoogleCloudPlatform/ios-docs-samples/issues/43

Related

XCode build error /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

I am trying build an IOS app written in ReactNative. The application written using XCode 11.4. Then I got a new Macbook with XCode version 12.5 installed. So I cloned the project from the git and run npm install and tried to run the project using XCode. Then I got the following error.
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
I checked any issues as suggested by the accepted answer in this link,https://stackoverflow.com/questions/10373016/command-xcode-app-contents-developer-toolchains-xcodedefault-xctoolchain-usr-bi. But there is nothing wrong with it.
Also, I tried cleaning the project and building the project again. It did not solve the problem as well.
Then I tried deleting the project targets that are for tests well and tried to clean and build the project again. But it did not work either.
I tried deleting everything in the Derived Data folder and tried building the project again as well. It did not work either.
When expand the log, this is the error I am seeing.
In file included from /Users/xandasupport/Desktop/Wais/PCL/pcl-app/node_modules/react-native/ReactCommon/jsi/JSIDynamic.cpp:6:
In file included from /Users/xandasupport/Desktop/Wais/PCL/pcl-app/node_modules/react-native/ReactCommon/jsi/JSIDynamic.h:8:
/Users/xandasupport/Desktop/Wais/PCL/pcl-app/node_modules/react-native/React/../third-party/folly-2018.10.22.00/folly/dynamic.h:63:10: fatal error: 'boost/operators.hpp' file not found
#include <boost/operators.hpp>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Why am I getting that error and I can I possibly fix it?

module 'audio_session' not found

I try to build an existing flutter project on a new Mac with M1 chip.
I face the following error in regards that the audio_session module is missing.
Launching lib/main.dart on iPhone 12 in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 340ms
Xcode build done. 4.7s
Failed to build iOS app
Error output from Xcode build:
↳
objc[7636]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f2fe0188) and ?? (0x117e8c2b8). One of the two will be used. Which one is undefined.
objc[7636]: Class AMSupportURLSession is implemented in both ?? (0x1f2fe01d8) and ?? (0x117e8c308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
/Users/user/Projects/myproject/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'audio_session' not found
#import audio_session;
~~~~~~~^~~~~~~~~~~~~
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.
Any thoughts?
You should
1 . open "Runner.xcworkspace" in xcode , Not "Runner.xcodeproj"
2 . everything going well
Finally, found a solution.
Somehow, If I went to the iOS folder of my flutter project and type 'pod init; pod install' a basic Podfile was generated (meaning that it had specified only the platform).
I found a post somewhere that suggested to delete everything in the iOS folder about pod and to run flutter run in the project. Running 'flutter run' in the project folder (that integrates 'pod install' as well), generated a much detailed Podfile, but this time I faced another error in regards with the platform (listed below).
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `12.0` on target
`Runner` because no platform was specified. Please specify a platform for
this target in your Podfile. See
`https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error: To set up CocoaPods for ARM macOS, run:
arch -x86_64 sudo gem install ffi
I tried to follow the suggestion to run the command shown above, but the same error occurred.
Then, I found an answer here Running Cocoapods on Apple Silicon (M1) that is similar with the official documentation https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon.
Even so, the answer from the stack overflow didn't work straight forward for me until I followed these steps:
Open finder -> Utilities
Right click on the Terminal -> Get Info
Check 'Open with Rosetta'
Open a new terminal and type 'gem uninstall cocoapods'
sudo gem install cocoapods
gem uninstall ffi
arch -x86_64 sudo gem install ffi
I hope this is useful for someone else.
In my case, I had changed the platform :ios to '13.0', but my iOS Deployment Target was '9.0'. I left the two the same and it started working again.
Make sure platform: iOS version in pod file matches with deployment
info in Xcode
Source: thanhbinh84
For me, it build succesfully after I ran flutter clean.
flutter clean
flutter pub get
flutter build ios
It worked for me.
18 nov 2020. M1, macOS Monterey.
Have the same issue with audio_session, but only in iPhone 15 simulator.
Download previous version on iOS.
Run without any other hacks.

Apple Mach-O Linker Error Group - React Native after installing firebase

I've been facing the following issue since I installed firebase dependencies from https://www.npmjs.com/package/#react-native-firebase/app as specified for React Native. Since then the Xcode console prints out the following error:
"ld: library not found for -lBVLinearGradient clang: error: linker command failed with exit code 1 (use -v to see invocation)"
That lib from Linear Gradient was causing no issue at all since the install of firebase and proper links following the documentation. Now it seems to be affecting other dependencies as well.
I've already re-created the iOS folder, ran pod install and the error persists. After doing that process, I had to link the project using react-native link to load the fonts I was using and the error came back again.
I am using the following version of Xcode: "Version 10.3 (10G8)", and the firebase dependencies inside pods folder are: "Firebase", "FirebaseCore" and "FirebaseCoreDiagnostics".
Note: inside pods folder there is no "LinearGradient" pod at all.
Recent versions of Firebase require at least Xcode 11 - and very soon, will likely require Xcode 12.

codenameone, error when build ios apps with google maps extension

I tried to build condenameone project with googlemaps extension but it failed.
this is the error log :
The following build commands failed:
CompileC build/Build/Intermediates/ArchiveIntermediates/DanoneCodi/IntermediateBuildFilesPath/DanoneCodi.build/Release-iphoneos/DanoneCodi.build/Objects-normal/armv7/com_codename1_googlemaps_InternalNativeMapsImpl.o DanoneCodi-src/com_codename1_googlemaps_InternalNativeMapsImpl.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Failed xcodebuild step
How to fix this?
further question, if I want to decided to remvoe the googlemaps extensions, how to do it?
That's a partial log, we need the full log to help.
A common problem is developers including the cn1lib but not actually using it which fails as a callback collides with the optimizer that strips away unused parts.

clang: error: linker command failed with exit code 1 (use -v to see invocation) when setting up cocoapods environment

I am setting the cocoapods dependency management tool for iOS project, when building my project i got this error:
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am using Xcode 4.5 and Mac OS X Lion 10.7.4. Thanx in advance.
Can't comment yet, so posting as an answer.
It would help to have a bit more information on what you did to setup cocoapods, library settings in XCode and whether this is your first time using cocoapods or if the issue suddenly started. Try to give us a good idea of the details of your current situation.
For the time being, a little googling popped up this URL: https://github.com/CocoaPods/CocoaPods/issues/155
You might find it helpful, specifically the post near the bottom:
In my environment the issue was that the Pods project did not have a
target called ADHOC (as per the main project). I duplicated the Pods
release target, called it ADHOC, changed the OS Deployment Target to
my requirement (5.0) and then everything worked.

Resources