I am getting an error like this:
[WARN]Warning: Multiple build commands for output file /Developer/B/Be/build/Release-iphonesimulator/BB.app/no.png
<
I'm pretty sure this can be caused by an XCode 4 bug, at least in the cases that I've encountered it in.
It happens if you add multiple language dependent files to the project at the same time. I found this out by looking through the git differences. I did nothing in the commit but add some new localized nib files. But looking back at the difference of the project.pbxproj file it showed a bunch of new duplicate references added for files that were already in the project before. The files it did this too seemed random to me.
I reproduced this same exact behavior multiple times.
Deleting these files from the project does not fix the problem because it only deletes the original reference and leaves the duplicates. The only way to fix it is to go back a commit and start over, or hand edit the project file, which is a really good way to screw it up even more since it's hard to tell which duplicates to remove and you have to do it in a ton of different places.
Xcode 4 is just a huge disappointment for me.
Yet another variation on this issue. I had the same message come up none of the previously suggested solutions solved the problem (I definitely only had one copy of the offending file for instance).
My solution was to edit the project.pbxproj file in a text editor (after quitting XCode and backing up the file of course) and remove all references to the offending file. Then, after starting XCode again, I manually added the file back into the project and everything was ok.
(My suspicion is that this problem happened to me because of a manual, ie: non-XCode, merge of the project file.)
In the Project Navigator, select your Xcode Project file. This will show you the project settings as well as the targets in the project. Look in the "Copy Bundle Resources" Build Phase. You should find the offending files in that list twice. Delete the duplicate reference.
Xcode is complaining that you are trying to bundle the same file with your application two times.
As previously mentioned, this issue can be seen if you have multiple files with the same name, but in different groups (yellow folders) in the project navigator. In my case, this was intentional as I had multiple subdirectories each with a "preview.jpg" that I wanted copying to the app bundle:
In this situation, you need to ensure that Xcode recognises the directory reference (blue folder icon), not just the groups.
Remove the offending files and choose "Remove Reference" (so we don't delete them entirely):
Re-add them to the project by dragging them back into the project navigator. In the dialog that appears, choose "Create folder references for any added folders":
Notice that the files now have a blue folder icon in the project navigator:
If you now look under the "Copy Bundle Resources" section of the target's build phases, you will notice that there is a single entry for the entire folder, rather than entries for each item contained within the directory. The compiler will not complain about multiple build commands for those files.
React-Native users. goto file -> workspace settings -> build system -> change it to legacy build system. and it should build fine now. React-Native isn't compatible with the new file system yet.
another version of this situation can occur when there are duplicates in the Headers build phase.
to fix this …
Build Phases
Headers
build phase+|-
boxes in the lower left corner-
button