Search code examples
ioscocoapodsgoogle-nearby-messages

Google NearbyMessages cocoapod generates “duplicate output file” error


I’m having a problem with NearbyMessages in Xcode 11.2. When I add pod 'NearbyMessages' and then do pod install, when I open the xcworkspace, I get a “duplicate output file” error resulting from the Assets.car that is generated by “[CP] Copy Pods Resources” build phase:

warning: duplicate output file '/Users/.../DerivedData/NearbyDemo-elvzmjtrsxnstlemqnzociqoajhv/Build/Products/Debug-iphonesimulator/NearbyDemo.app/Assets.car' on task: PhaseScriptExecution [CP] Copy Pods Resources /Users/.../DerivedData/NearbyDemo-elvzmjtrsxnstlemqnzociqoajhv/Build/Intermediates.noindex/NearbyDemo.build/Debug-iphonesimulator/NearbyDemo.build/Script-EB8FCF95DAAD8AF429AAA51F.sh (in target 'NearbyDemo' from project 'NearbyDemo’)

I’ve searched and found old issues, e.g., Google Nearby Messages API Broke App Icon, that seem like they might be related. That post looks like it might be an earlier manifestation of the same problem with assets and NearbyMessages, but it looks like the old compiler may not have caught this error.

In Xcode 10.3, this is merely a warning:

ignoring duplicated output file: '/Users/.../DerivedData/NearbyDemo-elvzmjtrsxnstlemqnzociqoajhv/Build/Products/Debug-iphonesimulator/NearbyDemo.app/Assets.car' in shell script build phase '[CP] Copy Pods Resources'. This warning represents an extremely serious project misconfiguration and will likely cause some shell scripts in your project to be skipped entirely, leading to other build failures or missing files in the build directory. This will be a hard error in the future. (in target 'NearbyDemo’)

Does anyone know of anyway to resolve this? I can downgrade Xcode, probably letting this problem pass without a hard error, but that’s not a terribly appealing solution.


It probably isn’t relevant, but here’s my Podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'NearbyDemo' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for NearbyDemo
  pod 'NearbyMessages'
end

I’m using Cocoapods 1.8.4 and Xcode 11.2 (11B52) on macOS 10.15.1.

I’ve posted a “Nearby Messages API for iOS - Product feedback” report, but was wondering if anyone has found a workaround in the interim.


Solution

  • After some searching, I found a workaround that should help with this behavior. You can achieve this by changing Xcode settings to use the old build system.

    Xcode / File / Workspace Settings / Build system / select "Legacy Build System"

    If you need further information, check out this link - https://github.com/CocoaPods/CocoaPods/issues/8122

    enter image description here