简体   繁体   中英

Unable to Archive ReactNative project in Mac M1

When I try to Archive, I get the following error -

Multiple commands produce '/Users/kumar/Library/Developer/Xcode/DerivedData/project-giaimtwxkjihslcrnslgrczdvfrm/Build/Intermediates.noindex/ArchiveIntermediates/project/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle':

1) Target 'React-Core.common-AccessibilityResources' has create directory command with output '/Users/kumar/Library/Developer/Xcode/DerivedData/project-giaimtwxkjihslcrnslgrczdvfrm/Build/Intermediates.noindex/ArchiveIntermediates/project/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'

2) Target 'React-Core.common-Hermes-AccessibilityResources' has create directory command with output '/Users/kumar/Library/Developer/Xcode/DerivedData/project-giaimtwxkjihslcrnslgrczdvfrm/Build/Intermediates.noindex/ArchiveIntermediates/project/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'

If I remove React-Core.common-AccessibilityResources from Pods, the share extension doesn't build stating that it needs this Pod.

Stack I am using -

RN - 0.64.2
React - 17.0.1
Node - 14.17.3
npm - 7.5.0
Xcode - 12.5.1
Macbook Air M1

Removing React-Core.common-AccessibilityResources from target in Podfile fixed the issue.

...
use_flipper!
post_install do |installer|
  flipper_post_install(installer)

  installer.pods_project.targets.each do |target|
    if target.name == "React-Core.common-AccessibilityResources"
      target.remove_from_project
    end
  end
end
...

IF THAT DIDNT WORKED TRY THIS:

I fixed this error by deleting 'React-Core.common-AccessibilityResources' from my pod targets. When attempting to archive, make sure you are not using.xcodeproj and using your workspace. Even if you think you are using workspace triple check. Also if you try archiving through the command line you must specifically state workspace.

CREDITS: How to fix React Native App not building for iOS

Xcode 12 Error: Multiple commands produce AccessibilityResources.bundle

I figured out, that I was having a different configuration of ReactNative for the share extension than the main app, which was importing the dependencies twice.

Here's a snippet from the PodFile

target 'project' do 
  ...
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => true
  )

  ...
end

target 'shareExtension' do
  ...
  use react_native!
  ...
end

For the share extension, I replaced the config with this

target 'shareExtesion' do
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => true
  )

  ...
end

After making this change in Podfile , do necessary cleanups, pod install and it worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM