Xcode 10错误:多个命令生成 - React Native

22

虽然已经有很多类似的问题了,但我遇到了相同的错误,与cocoapods或info.plist无关,至少我认为不是,因为所有的解决方案都不适用于我。

我最近刚升级到Xcode 10.0,构建我的React Native应用程序时出现以下错误:

Multiple commands produce '/Users/username/Library/Developer/Xcode/DerivedData/appname-code/Build/Products/Release-iphoneos/appname.app':
1) Target 'appname' has create directory command with output '/Users/username/Library/Developer/Xcode/DerivedData/appname-code/Build/Products/Release-iphoneos/appname.app'
2) That command depends on command in Target 'appname': script phase “[CP] Copy Pods Resources”

我该如何修复这个错误?


不确定,但我会从清理派生数据开始...删除 /Users/username/Library/Developer/Xcode/DerivedData,然后重新构建。 - drewster
4个回答

18

我通过以下步骤在Xcode 10.2中解决了我的问题:

将构建系统更改为Legacy

文件 > 工作区设置 > 构建系统 > Legacy Build System。

输入图片描述


1
最简单的解决方案 - Anuj
2
它起作用了,我在多个命令产生错误的路径... / .ttf 文件上遇到了问题。 - Ajay S

11

我通过将Cocoapods升级到最新版本来解决了这个问题:

  1. 关闭Xcode项目。
  2. 升级Cocoapods到最新版本 - 运行 "sudo gem install cocoapods"
  3. 按照此处的步骤删除现有的pods
  4. 在项目目录中运行"pod install"

1
我尝试了一下,但只有这个 https://dev59.com/pVUL5IYBdhLWcg3wM1g6#52451421 对我有用。 - Almeida

1

对于使用React Native和Cocoapods的人

这个问题是由一些libRN...a文件造成的。我通过从Build Phases -> Link Binary with Libraries中删除一些文件(例如libRNScreens.a和libRNGestureHandler.a),因为它们已经被其他库引用,来解决了这个问题。其他一些文件需要替换为它们的Pod版本,例如libRNDeviceInfo.a:

enter image description here enter image description here


1
我的解决方案是从Podfile中删除所有installer.pods_project.targets.each do |target| ...修复代码,同时我还删除了pod 'React',:path => '...。所以现在我的Podfile看起来像这样。
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'

target 'AppName' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => false
  )

  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
  end
end

默认的React Native Podfile

我正在从React Native 0.59 迁移到 0.64


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接