Android Studio cannot run the Xcode Simulator - xcode

I am trying to simulate my Flutter app with the Xcode iPhone Simulator and I get this error. Before upgrading Android Studio and Xcode it was working fine.
Launching lib/main.dart on iPhone X in debug mode...
Starting Xcode build...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: Multiple commands produce '/Users/User/AndroidStudioProjects/my_app/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
1) Target 'Runner' has copy command from '/Users/User/AndroidStudioProjects/my_app/ios/Flutter/Flutter.framework' to '/Users/User/AndroidStudioProjects/my_app/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
warning: ignoring duplicated output file: '/Users/User/AndroidStudioProjects/my_app/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework' (in target 'Runner')
note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone X.
Using:
macOS 10.13.6 (17G65)
Android Studio 3.2 Build #AI-181.5540.7.32.5014246, built on September 18, 2018
Xcode 10.0 (10A255)
Xcode Simulator 10.0 (SimulatorApp-869.5 CoreSimulator-572.2)

Should be fixed in master channel
https://github.com/flutter/flutter/issues/20685#issuecomment-421511890
Workarounds
There are two workarounds:
Option 1: Use the legacy build system . As noted by #gi097, open ios/Runner.xcworkspace, and change the build system to Legacy Build
System.
Option 2: Use the new Xcode 10 build system.
Open ios/Runner.xcworkspace
Select the Runner project in the project navigator sidebar.
In the main view, select the Runner target, then select the Build Phases tab.
Expand the Embed Frameworks phase and select Flutter.framework from the embedded frameworks list.
Click - to remove Flutter.framework from the list (be sure to keep App.framework).

Related

Xcode build is missing expected TARGET_BUILD_DIR build setting

I face error while launching on device on iPhone 12 Pro Max. This is console log
Launching lib/main.dart on iPhone 12 Pro Max in `debug mode`
Running Xcode build...
Xcode build done. 270.9s
Xcode build is missing expected TARGET_BUILD_DIR build setting.
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
I just ran into this and fixed it as follows:
run command flutter upgrade
run command flutter clean
run command flutter pub get if you have missing dependencies
attach phone
run command flutter run
If it still fails, open the Xcode runner project, set your development team and run it directly from there.
After it runs, close Xcode, do a clean build, and run it using your preferred approach.

React native project not on present IOS simulator or on Xcode

this is the second part of a bigger problem where the first part was solved here React native project deleted on xcode, can't run "run-ios react-native".
I have deleted my project on Xcode may it be .xcworkspace or .xcodeproje.
Because of that, I had to delete IOS and android folders while downgrading, updating and re-upgrading my react version to re-install IOS and android folders.
Thanks to that the emulator is working but unfortunately the project isn't present in the emulator and is still absent with Xcode. One thing to point out is that the simulator only appears when ran in the integrated terminal and nor in general terminal after cd-ing in the project folder.
Can anyone please help re-integrating the project in the emulator and on Xcode please.
Here is the error when the emulator is running in a general terminal:
error Command failed: xcrun instruments -s
xcrun: error: Failed to determine realpath of '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk' (errno=No such file or directory)
xcrun: error: unable to find utility "instruments", not a developer tool or in PATH
Here is the error for building the project within emulator when ran from VS code integrated terminal:
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 project.xcodeproj
In Xcode, select Xcode menu, then Preferences, then Locations tab. Click on the advanced button, select legacy and exit Xcode.

Getting error while running flutter project in simulator in debug mode

Error comes after running flutter run
The Xcode project does not define target "Runner" which is needed by
Flutter
tooling.
Open Xcode to fix the problem:
open ios/Runner.xcworkspace
Encountered error while building for device.
Just make sure that your app target called "Runner". It seems that flutter tooling relies on this target name.
Example

Missinig provisoning profile error when building an ios ionic app using xcode 10

I updated my version of xcode yesterday, and now when I build an ionic app that worked perfectly before I get the following error when validating the ipa:
Unable to process application at this time due to the following error: Missing Provisioning Profile - Apps must contain a provisioning profile in a file named embedded.mobileprovision..
How can I get the embedded.mobileprovision to be generated/ included?
Thanks,
Yuval
Currently the best workaround is to opt-out of the new build system:
If you're building on the command-line, you can specify --buildFlag="-UseModernBuildSystem=0":
Cordova CLI
cordova run ios --buildFlag='-UseModernBuildSystem=0'
cordova build ios --buildFlag='-UseModernBuildSystem=0'
Ionic CLI
ionic cordova run ios -- --buildFlag="-UseModernBuildSystem=0"
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
If you're building with a build.json config file, you can add the following under the iOS release or debug config:
"buildFlag": [
"-UseModernBuildSystem=0"
]
If you are opening the project in the Xcode IDE, you need to change the build system in Workspace Settings to "Legacy Build System"
Solution from here
Worked For Me. Cheers.
https://github.com/apache/cordova-ios/issues/407 has an answer,
\just build with the --buildFlag="-UseModernBuildSystem=0" and adjust project settings to build using legacy mode.
It seems like this issue has been resolved with the release of cordova ios 5.0.0 ( https://cordova.apache.org/announcements/2019/02/09/cordova-ios-release-5.0.0.html ) - they added compatibility with the modern build system

xcode build fails with error code 65 without indicative message

I'm experiencing weird behaviour with my iPhone CI job (running in TeamCity). Every once in a while our build fails without any indicative error in the build log. The build reaches the last stage of codesign validation and I get ** BUILD FAILED ** message immediately after.
These are the last lines of the log of a good and bad builds -
Bad Build
[15:00:56] : [CodeSign] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Library/TeamCity/buildAgent/work/dc055fa257f562be/DerivedData/MyProject/Build/Products/AdHoc-iphoneos/MyProject.app
[15:00:58]W: [Step 3/6] ** BUILD FAILED **
Good Build
[14:09:13] : [CodeSign] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Library/TeamCity/buildAgent/work/dc055fa257f562be/DerivedData/MyProject/Build/Products/AdHoc-iphoneos/MyProject.app
[14:09:13] : [Step 3/6] ** BUILD SUCCEEDED **
Because it's running in a CI I looked for user interaction problems (opening the keychain...etc') but usually xcodebuild spews the relevant errors.
Is there any other log I can dig into to find the cause of the build failures?
EDIT:
Seems I had the same problem like build failed jenkins iOS no error.
I also had a similar problem, in my case it was caused by the fact I'm using both Xcode 7.2 and Xcode 6.4 side by side. When the simulator of Xcode 6.4 is open (iOS Simulator 8.4) and I try to start a test from the commandline using Xcode 7.2 I get this 65 error.
Eg. when iOS Simulator 8.4 is open:
# sudo xcode-select -s "/Applications/Xcode 7.2.app/Contents/Developer"
# xcodebuild test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -workspace "/path/to/MyWorkspace.xcworkspace" -scheme "MyProject" -destination "platform=iOS Simulator,name=iPhone 6,OS=9.2"
(cut)
** TEST FAILED **
# echo $?
65
Solution is to kill the simulator before starting the test:
# killall "iOS Simulator"
# killall "Simulator"
The process is called "iOS Simulator" for XCode 6.4 and earlier and called "Simulator" for later XCode versions.
Had the same problem as build failed jenkins iOS no error
tl;dr - CopyPNG failed because of two images with the same name.
You need to remove platform ios - cordova platform rm ios, and then add platform - cordova platform add ios. now build ios - cordova build ios
I hit this when updating to Xcode 8, in my case it was because I had set the PROVISIONING_PROFILE_SPECIFIER setting incorrectly
For Xcode version 13
The following is what worked for me, this is aimed at Xcode version 13, hoping to be helpful
My React native project was cloned, i was able to run the app in android, but while running on iOS it showed error code 65.
After trying most of the solutions and failing, i got it fixed finally. This is what worked for me, and could be useful for some people hopefully.
Clone the project again(not necessary, just telling you what was done)
npm install
pod install (in iOS directory)
If Xcode shows error code 65, if there is legacy deprecation issue --> go to Xcode -->file --> workspace settings --> Check the box at the end of the window saying "do not show diagnostic issue about build system deprecation
run the project again
This is what fixed it for me.
My issue came up after updating to the latest version of Xcode. To resolve, I performed the following steps.
Completely quit Xcode and the Simulator. I had a zombie Simulator process running that I found and closed through Activity Monitor. Be sure no processes for Xcode or Simulator are running.
In Xcode, open the project found in the ios folder of your react-native project.
Xcode may suggest some recommended updates to modules. I accepted their recommendations.
Close Xcode, relaunch your react-native app

Resources