I have flutter project, I’m trying to run the iOS version but I get error after I update flutter and Xcode to the latest version, I use firebase core plugin
error:
Could not build the precompiled application for the device.
Error (Xcode): File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
I also tried to all installed pods by:
pod deintegrate
rm Podfile.lock
rm -rf Pods
and then update the repositories and install the pods and I still get the same error, should I reninstall xcode?
Flutter packages:
firebase_core: ^2.8.0
firebase_crashlytics: ^3.0.17
firebase_analytics: ^10.1.6
firebase_messaging: ^14.3.0
Any workaround for this? and thank you for your time
16
Answers
Edit 2:
I fixed the issue, even though I'm not sure if that is a good solution, run the following:
Just open the ios project inside the flutter project in Xcode, go to Pods in the folders (files) tab, go to the targets, go to the targets (it pod I guess, one dependency) that causes the issue, in my case FMDB and App auth, upgrade the minimum deployments for both from the current version (in my case 9.0) to 13.0 and try run the app again by build it and run it in Xcode or using flutter run with the selected ios device, and the issue should be gone
however sometimes when you clean the project in flutter (using
flutter clean
), it will reset those changes, or when you delete the pods and deintegrate Cocapods and re-install the app, all the changes will be reverted back to the default, it not really an efficient solution, but at least you can run the appand if the issue is still exists, update the minimum deployment for the pods target again and run the app using Xcode, if you still have the issue, try out the other answers or you can try update cocapods by
if your mac machine is apple silicon (m1, m2), you also need run
The official documentation said that
Edit: This solution idea come to me, all thanks to @Siyu
If you are from the future, you might want to try to upgrade the packages and cocapods, flutter etc...
Try updating your ios/Podfile. Change 13.0 with the version you have at the top of the file.
Facing this issue as well and went down the same path.
Upgrading the deployment target to 13.0 unfortunately only solves the issue for the debug version of the app. Then, you will at least be able to run it in the simulator again.
Archiving the app (e.g. build ipa to submit to store) will still fail with Xcode 14.3 for now due CocoaPods (Upgrade from xCode 14.2 to 14.3 PhaseScriptExecution failed with a nonzero exit code).
Unfortunately, the (only?) solution at the moment seems to be downgrading to 14.2 while waiting for a fix from the CocoaPods side (https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1481244508)
Update
The issue seems to have been found and fixed (https://github.com/CocoaPods/CocoaPods/pull/11828), but is not yet merged – Hopefully this will happen soon. In the meantime, replacing source="$(readlink "${source}")" with source="$(readlink -f "${source}")" in the …framework.sh files seems to help.
Providing my share of thoughts.
I’m building for MacOS and the file Xcode was complaining about is
libarclite_macosx
. So similar scenario.The solution is to change the deployment target to
RECOMMENDED_MACOSX_DEPLOYMENT_TARGET
, which is currently equivalent to MacOS 10.13 for Xcode 14.3.This essentially removes the dependency of that unnecessary file because
Reference:
https://developer.apple.com/forums/thread/725300
For your case, I believe that means update the deployment target within Xcode and podfile.
I fixed this by adding the following to the
post_install
section of my pod file (replace the deployment target with your required):If you’ve updated to xcode 14.3 and above. Do the following:
Open file project.pbxproj (ios/Pods/Pods.xcodeproj/project.pbxproj) and make sure "IPHONEOS_DEPLOYMENT_TARGET" is set to 11.0 or greater.
To make changes permanent add target deployment in the podfile as follows:-
Then run "flutter pub get".
You should be good to go.
Inspired by @dawnsong
Check the iOS Deployment Target for the installed pod, it should be minimum iOS 11.0.
Pod (select a pod) -> Build Setting -> Deployment -> iOS Deployment target (minimum 11.0)
I just had the same issue when updated my Xcode to 14.3
I have found a quick workaround by updating iOS Deployment Target of my installed pods. I have set iOS Deployment Target to 11 for the pods that are targeted below 11. This works like a charm but if you reinstall your pods you will need to do this change again as pods will be installed by their default deployment targets.
Then I have placed install script in to my Podfile as below. Then I run pod install command on command line to reflect the changes. Note I set the deployment target 11 first but I got error because some of my pods needs at least 13, so I have changed it to 13 because It will affect all of your pods.
I’m able to build my project into emulator as well as my own device but unable to archive it to push to AppStore. Knowing that this is a bug in Xcode 14.3, and none of the change minimum requirement or other Podfile modification method, I solved it by using 14.2 and ignore 14.3 for the time being
Having my Xcode installed from AppStore, the slowest method of all, I used a Xcode version manager that I found from here https://betterprogramming.pub/easily-swith-between-xcode-versions-b36f9f685979
Long story short here are some snippets of the steps I took
Step 1: Install Xcode manager and install Xcode 14.2 (It’ll ask for your AppleID credentials)
Step 2: Open Xcode-14.2.app from your MacOS Applications folder
Step 3: If your project works in Xcode 14.2 before then hopefully this will fix it
The Issue is resolved in later Flutter versions
run
flutter upgrade
and re-initializing the dependenciesif it’s not solve the error follow the steps that mentioned bellow
Make sure you have update the pod files after that follow the steps mentioned below:
Step 1
Track the issue cased by library here in my case I got an error for FMDB file
Step 2
Change the iOS version on effected pod with dropdown menu (small blue arrow)
Step 3
Change Distribution setting on Target Pod
Rebuild your app again on Xcode.
and repeat the process until you
solve all library issues
This works:
https://dev.to/curtlycritchlow/how-to-fix-missing-file-libarcliteiphonesosaxcode-143-4hki
which will need to be done each time after you run pod install
or you can simply add this at the end of Podfile
As I’ve seen the problem was coming from Flutter’s plugins deployment target that is still at 8.0, which is solved by manually updating it to a higher version with Xcode, in case you want to make it automatically, you can put these codes inside ios/Podfile at post_install
so it will look like this
after that run
pod install
in the ios folder…What it does do?
The code will override every pod’s deployment target that is still at 8.0 into 11.0, by this logic you’ll not bother any plugins that maybe requires a specific deployment target (which is higher than 8.0 for sure)
I had this problem with many of my libraries and I found the solution by changing the minimum deployments of the libraries. I got rid of the build error by updating the minimum deployments from 8.0 to 11.0.
For cordova projects add following line in config.xml under platform ios
The originally reported missing
libarclite_iphoneos.a
compilation failure is caused when when Flutter plugins have a dependency (a CocoaPods pod) with a minimum iOS version < 9.0. It seems Xcode 14.3 removed a library from its toolchain required to build these lower versions. Flutter 3.7.11 has a workaround for both iOS and macOS.More details in https://github.com/flutter/flutter/issues/124340.
The other (unrelated) issue being discussed in these answers is the failure to archive an iOS or macOS app. This was due to a different Xcode 14.3 behavior change that broke a CocoaPods script https://github.com/CocoaPods/CocoaPods/issues/11808. There is a workaround in Flutter tracked in https://github.com/flutter/flutter/issues/123890 and available in Flutter 3.7.10.
If you are seeing either issue, please run
flutter upgrade
to get the latest version of Flutter with these fixes. If you are still seeing issues, please file a new GitHub issue and myself or another Flutter maintainer will take a look.You can follow the below steps to fix this:
3.7.10
or above installed on your machine.podfile
,podfile.lock
,pods
directory, andpubspec.lock
file should fix it.podfile
and replace the below codewith code
and rebuild. This should fix it for sure.