oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.39k stars 2.12k forks source link

[Xcode 11] 'Multiple commands produce' error when building with new Xcode build system #1074

Closed fungilation closed 4 years ago

fungilation commented 4 years ago

Environment

MacOS 10.14.6 RN 0.60.5 Latest RNVI Building on iOS

Description

Describe your issue in detail. Include screenshots if needed.

Reproducible Demo

https://github.com/facebook/react-native/issues/20492#issuecomment-533912772

On Xcode before upgrade 11, things work correctly and font assets copy without fatal error.

After Xcode 11 stable released and upgraded, it required fonts removal under [CP] Copy Pods Resources in Build Phases. Subsequent pod update brings them back, needing manual removal again.

Not sure if this is fixable only with special treatment on Xcode >= 11?

monisamjad commented 3 years ago

For us, we had font entries in Copy bundle resources as well as copy pods resource. Fonts were also in the info.list file. Removing from pods resources worked for us.

juninhoall commented 3 years ago

Tested on the following versions of packages:

  • react-native: 0.62.2;
  • react-native-vector-icons: 6.6.0;

I've made this steps and project are building again:

  1. Add react-native-vector-icons:
$ yarn add react-native-vector-icons 
  1. Link resources to project:
cd <your-project>; react-native link; cd <your-project>/ios; pod install;
  1. Open project in the Xcode and click in the left side on your project name:
Screen Shot 2020-04-09 at 15 16 56
  1. Go to the Build Phases like the following:
Screen Shot 2020-04-09 at 15 17 03
  1. You'll see the Copy Bundle Resources like the following:
Screen Shot 2020-04-09 at 15 17 18

Note: Remove all font icons from the list, in the case of image icons was been removed.

  1. Run your project again to re-install with this update:
$ react-native run-ios

I hope this step by step helps you. ✨

Solved problem, thank so much.

hengkx commented 3 years ago

Is there a better solution?

RnbWd commented 3 years ago

Yes there is a better solution.. I fixed this issue by creating a new blank template with react-native-cli, and then delete the iOS / android folders, replacing them with the template, and using vscode to help modify the important files in the android / iOS folders. I also do all of my font linking manually instead of running react-native link

chamaldesilva commented 3 years ago

Find a solution, simply remove duplicate reference fonts in "Copy Bundle Resources" NOT in "[CP] Copy Pods Resources"

This works for me! thanks.

pcjbird commented 3 years ago

https://github.com/oblador/react-native-vector-icons/issues/1074#issuecomment-616335309

It works once pod install, but not for the first time.

happyfloat commented 3 years ago

I'm still using the patch for patch-package as other people here did mention before and its working well, also on CI:

File: react-native-vector-icons+8.1.0.patch

diff --git a/node_modules/react-native-vector-icons/RNVectorIcons.podspec b/node_modules/react-native-vector-icons/RNVectorIcons.podspec
index 4b716ee..08f6378 100644
--- a/node_modules/react-native-vector-icons/RNVectorIcons.podspec
+++ b/node_modules/react-native-vector-icons/RNVectorIcons.podspec
@@ -12,7 +12,6 @@ Pod::Spec.new do |s|
   s.platforms      = { :ios => "9.0", :tvos => "9.0" }
   s.source         = { :git => "https://github.com/oblador/react-native-vector-icons.git", :tag => "v#{s.version}" }
   s.source_files   = 'RNVectorIconsManager/**/*.{h,m}'
-  s.resources      = "Fonts/*.ttf"
   s.preserve_paths = "**/*.js"
   s.dependency 'React-Core'
jonatansouza commented 3 years ago

Remove all .ttf files that belongs to react-native-vector-icons from Copy Bundle Resources under the Build Phases in Xcode works for me.

naxir commented 3 years ago

@bpouzet solution <3

ArthurNvs commented 3 years ago

@kindacoder see if same fonts exist, because if you install two packages that have fonts there's a chance there will be duplicates. I had installed react-native-vector-icons and native-base, both had fonts and there were duplicates in the bundle resources and that was causing this error. Here's where I found the solution

saved the day

zoobibackups commented 3 years ago

if I remove the fonts from the Copy Bundle Source file the build succeed but it gives me another error unrecognised Font family 'MarlinGeo-Black'. There are my Error.

<img width="1280" alt="Screenshot 2021-07-01 at 10 40 00 AM" src="https://user-images.githubusercontent.com/78194973/124072516-45545a80-da5a-11eb-85b2-24002b9714c1.png">

Multiple commands produce '/Users/umairhassan/Library/Developer/Xcode/DerivedData/truecaller-altzuyoazoqmqdeceflrhwqheodc/Build/Products/Debug-iphonesimulator/truecaller.app/L-Bold.ttf':
1) Target 'truecaller' (project 'truecaller') has copy command from '/Users/umairhassan/repos/CallerApp/src/assets/fonts/L-Bold.ttf' to '/Users/umairhassan/Library/Developer/Xcode/DerivedData/truecaller-altzuyoazoqmqdeceflrhwqheodc/Build/Products/Debug-iphonesimulator/truecaller.app/L-Bold.ttf'
2) That command depends on command in Target 'truecaller' (project 'truecaller'): script phase “[CP] Copy Pods Resources”

Here I have my ScreenShots .

Simulator Screen Shot - iPhone 12 Pro Max - 2021-07-01 at 10 37 50

Screenshot 2021-07-01 at 10 40 00 AM

if I remove these from here then the error show in the first screenshot I got. and if I add there lines then the second one.

can anyone explain this.

connercms commented 3 years ago

Can someone explain why removing the fonts from Copy Bundle Resources is the solution when the documentation for RNVI explicitly tells you to have them there?

Per the RNVI docs: "Note: you need to recompile your project after adding new fonts, also ensure that they also appear under Copy Bundle Resources in Build Phases."

Removing them from Copy Bundle Resources finally allowed my app to build however, and the icons are still present.

goff-studio commented 3 years ago

for me, the safest and easiest way was:

npx react-native unlink react-native-vector-icons npm uninstall react-native-vector-icons npx pod-install npm install react-native-vector-icons npx pod-install npx react-native run-ios

that's it!

pasza01 commented 3 years ago

Below solution worked for me after 2 hrs of struggle

https://stackoverflow.com/questions/52085275/unrecognized-font-family-roboto-react-native-ios/57186931

lsbyerley commented 3 years ago

for me, the safest and easiest way was:

npx react-native unlink react-native-vector-icons npm uninstall react-native-vector-icons npx pod-install npm install react-native-vector-icons npx pod-install npx react-native run-ios

that's it!

which method did you use for the ios installation (https://github.com/oblador/react-native-vector-icons#ios) ... the cocoa pods one? I'm still getting a Unrecognized font family Material Design Icons error when running npx react-native run-ios command

goff-studio commented 3 years ago

for me, the safest and easiest way was: npx react-native unlink react-native-vector-icons npm uninstall react-native-vector-icons npx pod-install npm install react-native-vector-icons npx pod-install npx react-native run-ios

that's it!

which method did you use for the ios installation (https://github.com/oblador/react-native-vector-icons#ios) ... the cocoa pods one? I'm still getting a Unrecognized font family Material Design Icons error when running npx react-native run-ios command

React Native Link [that I'm working on 0.64 version, so basically, Linked automatically after installation.

alitele commented 3 years ago

For those want to know the reason behind it.

When React has already auto linked vector icons and you do manual link there comes duplicate resources. Cheers.

nabilfreeman commented 3 years ago

Whyyyyyyyyyy is this still a thing :(((((((((((((((((

christophermaloney commented 3 years ago

I had to uncheck "For Install builds only" on [CP] Copy Pods Resources for it to work for me. I also manually added the font names into the "Fonts provided by application" section in the info.plist and removed the font files from Copy Bundle Resources but not sure if that was required.

Hopefully this helps someone.

acro5piano commented 3 years ago
  1. Follow the official instruction
  2. Remove all font files from "Copy Bundle Resources" as described in this thread

My fault was not editing my "info.plist"

thangpq commented 3 years ago

Same here.

It looks like a bug or some new issue with new Xcode version.

Error response is:

Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65.

Detailed response:

Build system information error: Multiple commands produce '/path/of/the/project/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/Zocial.ttf':

_1) Target 'NameOfTheProject' (project 'NameOfTheProject') has copy command from '/path/of/the/project/NameOfTheProject/nodemodules/react-native-vector-icons/Fonts/Zocial.ttf' to '/path/of/the/project/NameOfTheProject/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/Zocial.ttf'

2) That command depends on command in Target 'NameOfTheProject' (project 'NameOfTheProject'): script phase “[CP] Copy Pods Resources”

Build system information error: Multiple commands produce '/path/of/the/project/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/SimpleLineIcons.ttf':

_1) Target 'NameOfTheProject' (project 'NameOfTheProject') has copy command from '/path/of/the/project/NameOfTheProject/nodemodules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf' to '/path/of/the/project/NameOfTheProject/ios/build/NameOfTheProject/Build/Products/Debug-iphonesimulator/NameOfTheProject.app/SimpleLineIcons.ttf'

2) That command depends on command in Target 'NameOfTheProject' (project 'NameOfTheProject'): script phase “[CP] Copy Pods Resources”

...

That response repeat for each .ttf file used by the library.

I had to temporary react-native unlink react-native-vector-icons, and the project build again, but with not icons.

You save my life :( Many thanks

thangpq commented 3 years ago

Find a solution, simply remove duplicate reference fonts in "Copy Bundle Resources" NOT in "[CP] Copy Pods Resources"

perfect !

tti-prasad commented 3 years ago

For anyone else who didn't know this, Copy Bundle Resources can be found under the BuildPhases` tab in the target in your project

Thank you. You saved my day Man!!

ssathishppm commented 3 years ago

Any option to remove those files from copy bundle resources dynamically (using command line) OR how to avoid adding those files

vjcspy commented 3 years ago

for me, the safest and easiest way was:

npx react-native unlink react-native-vector-icons npm uninstall react-native-vector-icons npx pod-install npm install react-native-vector-icons npx pod-install npx react-native run-ios

that's it!

It work perfectly!

Danirill commented 2 years ago

Does anyone know how to fix this problem with AppCenter?

mpeguese commented 2 years ago

Following this video finally got my fonts to show up. I was getting red question mark for a few hours and duplicate error message. Hope this helps someone out.
https://www.youtube.com/watch?v=5Rc0ujISKUo

souradeepmajumdar05 commented 2 years ago

Find a solution, simply remove duplicate reference fonts in "Copy Bundle Resources" NOT in "[CP] Copy Pods Resources" remove all ocurrence of the duplicate tff files

saravanakumargn commented 2 years ago

Screenshot 2022-01-11 at 7 29 19 PM

Jcs1994 commented 2 years ago

you all were on xcode while i was looking on vscode xD

KrisLau commented 2 years ago

UPDATE: Not sure what fixed it but it works now

Nothing working for me. Anyone have any ideas? All the fonts added in my Info.plist with no duplicates: image. Removing them from the Copy Bundle Resources solves the multiple commands produce error but that gives me and Unrecognized font family error: image

I also tried @goff-studio's workaround of unlinking, uninstalling and reinstalling the package and @mpeguese's video (creating a Fonts folder in the project folder) with the same results as above,

My app builds fine but its the deploys using Fastlane that are having issues

saad277 commented 1 year ago

Worked for me : https://github.com/facebook/react-native/issues/29709#issuecomment-683395558

Shaxadhere commented 1 year ago

removing icon files from Copy Bundle Resources worked for me

rrsalian16 commented 1 year ago

removing icon files from Copy Bundle Resources worked for me

this worked for me

anietieasuquo commented 1 year ago

I didn't have to remove the icon files manually. The easiest solution is to create a file in the root of the project: react-native.config.js, and add the following content;

module.exports = {
  dependencies: {
    'react-native-vector-icons': {
      platforms: {
        ios: null,
      },
    },
  },
};

You might have to rerun yarn install and also install pods again.

elibroftw commented 1 year ago

Would be nice if the following was in the README.md telling users to remove the font files rather than adding them if they are using autolinking (the default on the latest react native).

So to fix the problem, just remove the font files from Copy Bundle Resources, so that they are only in [CP] Copy Pods Resources.

Dat-Mobile commented 1 year ago

For me, I deleted Fonts folder inside project and it works

I listed the fonts in Info.plist

dazld commented 8 months ago

I didn't have to remove the icon files manually. The easiest solution is to create a file in the root of the project: react-native.config.js, and add the following content;

module.exports = {
  dependencies: {
    'react-native-vector-icons': {
      platforms: {
        ios: null,
      },
    },
  },
};

You might have to rerun yarn install and also install pods again.

It's 2024, and this is the best answer here. Thanks for sharing!

atultiwaree commented 7 months ago

By Mistake I've deleted copy bundle resources now after build I'm getting black screen how do I fix this ?