Search code examples
iosxcodereact-nativeyarnpkgreact-native-vector-icons

failed to add. react-native-vector-icons


W trying to add react-native-vector-icons into my app.

This is what I'm doing:

  1. yarn add react-native-vector-icons

  2. react-native link react-native-vector-icons

  3. Open Xcode project and create new group inside the root called Files.

  4. Into the files folder I paste all fonts inside node_modules/react-native-vector-itens

  5. And add this rows into info.plist file:

    <key>UIAppFonts</key>
        <array>
            <string>AntDesign.ttf</string>
            <string>Entypo.ttf</string>
            <string>EvilIcons.ttf</string>
            <string>Feather.ttf</string>
            <string>FontAwesome.ttf</string>
            <string>FontAwesome5_Brands.ttf</string>
            <string>FontAwesome5_Regular.ttf</string>
            <string>FontAwesome5_Solid.ttf</string>
            <string>Fontisto.ttf</string>
            <string>Foundation.ttf</string>
            <string>Ionicons.ttf</string>
            <string>MaterialCommunityIcons.ttf</string>
            <string>MaterialIcons.ttf</string>
            <string>Octicons.ttf</string>
            <string>SimpleLineIcons.ttf</string>
            <string>Zocial.ttf</string>
        </array>
    
  6. cd ios -> pod install.

  7. yarn ios

  8. I got this exception for each added font:

    Build system information
    error: Multiple commands produce '/Users/flavio.luiz/Library/Developer/Xcode/DerivedData/grdiariesapp-glxxnoufhzcqqqehxmwglijwtgap/Build/Products/Debug-iphonesimulator/grdiariesapp.app/FontAwesome5_Brands.ttf':
    1) Target 'grdiariesapp' (project 'grdiariesapp') has copy command from '/Users/flavio.luiz/Documents/learning/grdiariesapp/node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf' to '/Users/flavio.luiz/Library/Developer/Xcode/DerivedData/grdiariesapp-glxxnoufhzcqqqehxmwglijwtgap/Build/Products/Debug-iphonesimulator/grdiariesapp.app/FontAwesome5_Brands.ttf'
    2) That command depends on command in Target 'grdiariesapp' (project 'grdiariesapp'): script phase “[CP] Copy Pods Resources”
    

Can anyone help?


Solution

  • For versions < 0.60 you should put the files manually.

    Version > 0.60 autolinking will do the job so in your case you duplicate it so just delete the files you intrudoce and all will work as expected.