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


Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1