Build input file cannot be found: in my app derived data folder in Xcode 12.5.1 in m1

While running the app from Xcode, I am getting an error as the Build input file cannot be found.

I have tried deleting the DerivedData folder entirely and re-run the app.

Added arm64 and x86_64 in the Excluded architecture. But the error is still not resolved. Any workarounds.

Note: It occurs when archiving as well as when I try to run the app in simulator as well

Showing All Errors Only
Build input file cannot be found: '/Users/name/Library/Developer/Xcode/DerivedData/application-dhdivlzaazbgnkkglsibo/Build/Products/Debug-iphonesimulator/Application.app/Application'
OS: macOS Big Sur (m1)
Version: 11.3.1

Added arm64 and x86_64 in the Excluded architecture.

You should undo this. Setting anything in the Excluded architectures is almost always wrong except in carefully considered situations.

Build input file cannot be found: '/Users/name/Library/Developer/Xcode/DerivedData/application-dhdivlzaazbgnkkglsibo/Build/Products/Debug-iphonesimulator/Application.app/Application

One of your build phases has a reference to the built app binary as an input. When you cleared DerivedData, this file was deleted, and so now the build can't proceed because it's missing. Look through all of your build phases as well as the Xcode file navigator for any file references that refer to these files and remove them.

I moved in new Mac MPRo from Intel chip when I try to run on Simulator it is fine, not working for real device Has anyone found a solution to this?

Did you make sure that the executable file "Application" located in your folder "/Users/name/Library/Developer/Xcode/DerivedData/application-dhdivlzaazbgnkkglsibo/Build/Products/Debug-iphonesimulator/Application.app/" matches the value of the Executable file attribute in your Info project file?

On my machine, the executable path is : /Users/.../DerivedData/Debug-iphonesimulator/Runner.app/Runner. I noticed that it was wrong in the Info file. Correcting it fixed the issue for me.

See the the screenshot below :

Build input file cannot be found: in my app derived data folder in Xcode 12.5.1 in m1
 
 
Q