Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

duplicate UUIDs warning on pod install post_install step

When running the following in my podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

I get these warnings:

[!] [Xcodeproj] Generated duplicate UUIDs:

XCBuildConfiguration --
XCBuildConfiguration --
PBXBuildFile --
PBXBuildFile --

What's causing this? I noticed that I have some remnant tvOS targets in my schemes - is that a possible cause?

like image 683
MonkeyBonkey Avatar asked Apr 25 '18 22:04

MonkeyBonkey


1 Answers

It's caused by duplicate files in different directories. Sometimes Xcode might make mistake and duplicate files when you move files to another directory.

My solution to find these duplicate files,

  1. copy error messages to a text file named such as duplicateUUIDs.txt
  2. get sorted file names and output duplicated items
grep -E '[a-zA-Z+]+\.(h|m|swift)' -o duplicateUUIDs.txt | sort | uniq -d
  1. find them in your pod source directory and delete unnecessary files.

Another method to find duplicate files

find . -path ./.git -prune -o -type f -exec basename {} + | sort | uniq -d

where -path ./.git -prune -o means to exclude .git directory when finding

https://github.com/CocoaPods/CocoaPods/issues/4370#issuecomment-602368518

like image 169
DawnSong Avatar answered Nov 20 '22 16:11

DawnSong