Xcode build is missing expected TARGET_BUILD_DIR build setting - xcode

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.

Related

New flutter project couldn't build on mac os intel chip

New Flutter project cant build succefully in Mac mini intel chip
Output :
Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
lib/main.dart:1
Xcode build done. 17.2s
Failed to build iOS app
Error (Xcode): ../../flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:9:8: Error: Error when reading '../../.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/vector_math_64.dart': Permission denied
../…/material/bottom_navigation_bar.dart:9
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.
Exited```
`flutter doctor` seems to be fine
I tried delete SDK and create new one but didnt work, i hope someone can help.
Try running flutter clean then flutter create . in the root directory. This should reset the plugins. Also, check if there is any outdated plugins in your pubspec.yaml file.

Flutter desktop embedding

Following these instructions
I tried to run a new project on macOS(desktop) using Android Studio.
I get the following error:
Launching lib/main.dart on macOS in release mode... Finished with
error: Unable to get Xcode project information: xcodebuild: error:
The directory
/Users/current.user/Work/Playground/testout/flutter_app2/macos does
not contain an Xcode project, workspace or package.
I get the same issue if I run in the terminal flutter run --release -d macOS
Running on a simulator/device, works fine.
It doesn't sound like you followed the instructions for running a project other than the FDE example. A newly created Flutter project doesn't have support for running on desktop; you need to add that.
See also flutter.dev/desktop#create for information on the state of create and run for desktop.

Cordova Build causing xcodeBuild to quit unexpectedly

I've got a basic react app running in Cordova, when I run a
cordova build ios
Things seem to work OK but then after a short delay I get the following:
If I run a
cordova run ios
I get the following
No target specified for emulator. Deploying to iPhone-X, 12.1
simulator
/Users/Liam/code/ProjectName/app-src/platforms/ios/build/emulator/ProjectName/Info.plist
file not found.
I've done the usual, clean, remove platform, re-add platform but same issues. Any ideas what causes this or how to debug further?
I can run the Cordova App from XCode

Android Studio cannot run the Xcode Simulator

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).

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