Flutter error: xcodebuild: WARNING: Using the first of multiple matching destinations - flutter

Flutter version is 2.2.3 and I cant't run de flutter code on my iOS emulator.
Launching lib/main.dart on iPhone 13 Pro in debug mode...
lib/main.dart:1
Xcode build done. 43.6s
Failed to build iOS app
Error output from Xcode build:
↳
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
{ platform:iOS Simulator, id:320795B7-1385-4044-B442-87A9808936D9, OS:15.0, name:iPhone 13 Pro }
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS, id:00008101-000825EC3AE1001E, name:leobidoous iPhone, error:Device is busy (Making leobidoous iPhone ready for development, Processing cache files from device, Making the device ready for development) }
** BUILD FAILED **
Xcode's output:
↳
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel

I had the same problem updating Xcode. Solve just logging back into Xcode.
Open Xcode
Open the project's Runner.xcworkspace file
Log into Xcode at: "Signing & Capabilities" -> "All" -> "Signing"
Item 3 was my problem. When updating Xcode, I was logged out.

Adding these lines to Podfile Helped me.
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end
Example:

If you use package sign_in_with_apple, it should have 3.2.0 version at least.

put this code in your Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end
end
end

The only solution that worked for me was to completely remove the xcode installed and reinstall from the app store.
When removing the old xcode, make sure to remove all the residual files - especially the developer folder.
Try these following commands
sudo rm -rf ~/Library/Developer/
sudo rm -rf ~/Library/Caches/com.apple.dt.Xcode
and remove xcode from Application to bin. Doing this will completely clean the xcode residuals and then you can reinstall from the appstore.

I encountered same issue and by running flutter clean fixed the issue for me.
Also try restarting the IDE if this doesn't work.

For me, I am fine after forcing the Simulator.app quit and run the command again.

I faced the same issue for flutter version 2.5.1 stable
Previously i installed flutter using Zip archive file now I completely removed that installation and setup it using Git clone
I did things like flutter clean, pod clear cache , pod install etc
IMP Note in xcode please check developer signing&capabilities options for runner etc
I did these and these are worked for me

The relevant part here is
Command PhaseScriptExecution failed with a nonzero exit code
which means that any of the scripts configured in Xcode > Targets > Runner > (Tab) Build Phases failed. The problem here is that you do not see the error message (which script failed and why).
Add the --verbose flag (short: -v) to the flutter run command:
flutter run -v
This will output a lot. At the end you need to scroll a bit up to the the actual script error.
Once you know the actual error, you probably can solve it easily or open a new and more specific question.

I encountered the same error on flutter 2.5.3. Now I downgraded to 2.5.1 and the app is running on my iOS emulator. Try this may help you.

I have solved it by clean the IDEA + flutter clean then restarting Mac then open Xcode from flutter project then clean Xcode build by select product -> Celan Build folder then RUN your project from Xcode to download dependence

Add the below lines to your podfile. Place the below lines in the post_install do [installer] section at the bottom of the Podfile.
Code :
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end

All of the answers here, depending on your circumstances, have aspects that absolutely remove this error. For myself, what I can say is that I can confirm that using an 2021 M1 macbook pro max with a fresh set of tools, flutter 2.8.1, dart 1.15.1 and having the following or similar post_install section in my podfile also silenced the offending output.
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end
end
end

Try this. This process will re-download ios and android development tools again after running the code through the ios and android simulator. Worked for me
Flutter clean
Flutter get
Flutter channel stable
flutter upgrade
and restart IDE as well as close Xcode. works for me, I hope this helps

If your project is with firebase and it is cloned and cleaning is not well like me. Probably this can help you.
Add GoogleService-Info.plist back to your Runner project. (if already have can ignore)
Try to Clean Build Folder on xcode then Build again.
Try to build into Simulator using xcode.
Try to build into your connected iPhone.
If 3 and 4 is working. Back to your vscode then build and run again to iPhone or Simulator

Related

flutter stuck on Compiling, linking and signing

Flutter project is stuck in Compiling, linking and signing... i dont just understand why this is stuck here...
even using verbose i dont get any stack trace on why this is stuck...
Launching lib/main.dart on iPhone 13 Pro Max in debug mode...
Running pod install... 11.6s
Running Xcode build...
└─Compiling, linking and signing...
The problem should be in the existing project created on previous environment (old versions) and has to be resolved by creating a new one and moving content in.
Move all my custom contents from existing my project (assets, fonts, lib folders and config files...) to this new project and ran the command : the flutter build ios command works well now !
following this : Fixing Xcode 9 issue: "iPhone is busy: Preparing debugger support for iPhone"
I TRIED :
On Xcode:
Go to "Window" -> "Devices and Simulators"
"Unpair iPhone" (on the side list, right clic)
Then:
Unplug and plug again the USB cable
Press Trust in the prompt message in the device
in Flutter Terminal, paste and enter :
flutter clean
flutter pub get
cd ios
pod install --repo-update
cd ..
Then run the app.
==> Worked only 1st time for me.
My work around for launching IOS devices for now:
Each time I want IOS device,
I COPY/ PASTE and press ENTER on the Terminal:
flutter clean
flutter pub get
cd ios
pod install --repo-update
cd ..
flutter run

Flutter Will not run on IOS Simulator - Pods_Runner.framework' is missing one or more architectures

I upgraded to Flutter 2.5.0 and now I cannot run on an IOS simulator, from either Android Studio or the command line.
It fails with the error
Runner.xcodeproj: error: The linked framework 'Pods_Runner.framework' is missing one or more architectures
required by this target: arm64. (in target 'Runner' from project 'Runner')
I can manage to run on the Simulator from XCode without an issue
I can run on a device from Android Studio or command line
I have tried
restarting the simulator.
cleaning the build folder
upgrading Cocoapods to 1.11.1
Flutter Doctor says that everything is fine.
----------------- Edit ------------------
The situation Eventually Resolved Itself.
This is a problem because of ARM64 for me. This helped for me.
Be sure to open .xcworkspace.
Adding "arm64" to Project -> Build Settings -> Excluded Architecture
The reason why this might have been happened is because Xcode has been updated to a newer version. You gotta love Xcode..

Build error of react native run iOS on M1 Macbook

I initialized new react-native project with "react-native init ReactNStudy" for first time on my M1 Silicon Apple computer.
Metro builder worked without any problems.
When building step I get very log error. Starting part of the error like that:
info Found Xcode workspace "ReactNCalisma.xcworkspace" info Launching iPhone 12 (iOS 14.4) info Building (using "xcodebuild -workspace ReactNCalisma.xcworkspace -configuration Debug -scheme ReactNCalisma
-destination id=E914C899-172A-45AE-AFB6-BEBA505887E1") (node:25639) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created) error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening ReactNCalisma.xcworkspace. Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace ReactNCalisma.xcworkspace -configuration Debug -scheme ReactNCalisma -destination id=E914C899-172A-45AE-AFB6-BEBA505887E1
And ending part of the error like that:
objc[25723]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1fc2be7a0) and ?? (0x1189b42b8). One of the two will be used. Which one is undefined.
objc[25723]: Class AMSupportURLSession is implemented in both ?? (0x1fc2be7f0) and ?? (0x1189b4308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
The following build commands failed:
Ld /Users/USERNAME/Library/Developer/Xcode/DerivedData/ReactNCalisma-anxlznepgpgzoyfpokskqpwmffzt/Build/Products/Debug-iphonesimulator/ReactNCalisma.app/ReactNCalisma normal
(1 failure)
info Run CLI with --verbose flag for more details.
After that I tried to run with "xcodebuild":
cd ios && xcodebuild
But in this part I get error as:
fatal error: module map file
'/Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/Release-iphoneos/YogaKit/YogaKit.modulemap'
not found
** BUILD FAILED **
The following build commands failed:
CompileC /Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/ReactNCalisma.build/Release-iphoneos/ReactNCalisma.build/Objects-normal/arm64/ReactNCalisma_vers.o /Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/ReactNCalisma.build/Release-iphoneos/ReactNCalisma.build/DerivedSources/ReactNCalisma_vers.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/ReactNCalisma.build/Release-iphoneos/ReactNCalisma.build/Objects-normal/armv7/ReactNCalisma_vers.o /Users/USERNAME/Desktop/Projects/ReactNCalisma/ios/build/ReactNCalisma.build/Release-iphoneos/ReactNCalisma.build/DerivedSources/ReactNCalisma_vers.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)
I tried to solve with Pod delete and reinstall, I checked my Xcode terminal settings but I cannot solve this problem .
Is this problem about M1? How can I solve this?
I followed those steps on macbook M1 (problem with cocoapoda and build):
1- Using Terminal with Rosetta (Make sure all terminals are closed):
Go Finder --> Applications --> Utilities --> Terminal (Then right click on Get Info - check Open using Rosetta)
Now you can open Terminal & install Cocoapoda from terminal
2- Use Xcode with Rosetta (Make sure that Xcode is closed):
Go Finder --> Application --> Xcode (Then right click on Get Info - check Open using Rosetta)
Now Xcode/simulator will work as Rosetta
3- Comment this part in Podfile (in ios folder)
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# end
Then reinstall pod:
cd ios/
$ rm -rf build/
$ pod install
Check this video:
https://youtu.be/UrxM1SyAXAE
I had same problem. I fixed as below
I added into the Podfile
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
pod install
I also experienced same issue before. But, Now i can compile and build react native run-ios sucessfully.
I already resume and create guide article on how to run react native iOS Macbook with M1 Chip.
Quick step:
- set terminal to use Rosetta
- set XCode to use Rosetta
- small adjust on podFile if you have problem with react native flipper.
full guide follow from this : https://handi.dev/blog/how-run-react-native-on-macbook-m1-apple-silicon
If you didn´t find the answer yet:
I had the same issue and fixed it by downgrading my node.js version.

Flutter; Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1eb0e27a0) and ?? (0x1162f02b8)

Running pod install... 1.6s
Running Xcode build...
Xcode build done. 7.6s
Failed to build iOS app
Error output from Xcode build:
↳
objc[9381]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1eb0e27a0) and ?? (0x1162f02b8). One of the two will be used. Which one is undefined.
objc[9381]: Class AMSupportURLSession is implemented in both ?? (0x1eb0e27f0) and ?? (0x1162f0308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
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.
I have tried deleting the bin/cache folder as well, and it has not worked. Running on an M1 Mac.
In my case I solved the problem by removing a Firebase library I was using for the storage on the web.
It was conflicting with the iOS version for some reason.
I solved this using the following method:
Backup existing ios folder in your project
Create a new flutter app in you home directory.
flutter create my_app
Copy the ios folder from the newly created app into your existing project.
navigate to the project folder and run the app using flutter run
cd ~/myproject
flutter run
I am not sure why it worked, but it did. My guess is that I fouled up a config file or plist file somewhere.
I had the same problem. You may try the below:
Go to the project folder:
$ rm ios/Flutter/Flutter.podspec
$ flutter clean
Works for me.
The solution which worked for me. Sorry I didn't post earlier.
Go to your flutter project
Open your runner.xcodeproj folder
open the contents.xcworkspace file and you will have an option to open ios module on code
Run your code by pressing the play button
The build will fail so go to the error log. And the real error will be there. The AMSupportURLConnectionDelegate isn't the real reason your build is failing.
This error occurs because of the Xcode beta version.
If you are using Firebase Auth you may face this kind of issue, Change the X-code version as stable
change like this in your Podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
end
end
end
Open your iOS folder in your X-code and find the file like this FIRAUTH DEFAULT DELEGATE
#import <TargetConditionals.h>
#if !TARGET_OS_OSX && !TARGET_OS_WATCH
then close the Xcode and try flutter run
If it is not working you have to delete your pod files and then again do flutter run
For me this was firebase_crashlytics: ^0.2.3+1 causing the issue. Commenting out this allowed the build on simulator to run.

building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Getting this error.
Realm/core/librealmcore-ios.a(array_binary.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
Swift iOS 14 xcode 12.0.1
What I have tried :
Updating to the latest realm
Excluding the arm64 architecture
Nothing seems to work
Seems realm are having issues too : https://realm.io/docs/swift/latest/#cocoapods
"Arm64 simulator architecture may not be supported for several combinations of Realm 5.x and Xcode 12. Please attempt the following workarounds if you experience architecture-related build errors with the latest version of Realm."
Use
pod 'RealmSwift', '~> 10.5.0'
They already added support for xcframework.
It's not really a proper fix, but what worked for my project is:
following the suggestions provided by: https://realm.io/docs/swift/latest/#cocoapods
Installing cocoapods 1.10.0.rc1
setting the BuildActiveArchitectureOnly to Yes in the cocoapods project
Now when you build your app for your device or you're archiving make sure to set this back to No, or alternatively, use a different config for this (e.g: I have Debug set to Yes, Release to No).
What I did was
setting the BuildActiveArchitectureOnly to Yes in the build settings.
And
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
end
And
Updated my Realm to the latest version.