"TextCompositionLayer.swift" used twice IOS
LPranulis opened this issue · comments
Hello, I have a problem with iOS building.
info :0: error: filename "TextCompositionLayer.swift" used twice: '/Users/XXX/Documents/React-Native/PROJECT/node_modules/lottie-ios/lottie-swift/src/Private/LayerContainers/CompLayers/TextCompositionLayer.swift' and '/Users/XXX/Documents/React-Native/PROJECT/node_modules/lottie-ios/lottie-swift/src/Private/LayerContainers/CompLayers/TextCompositionLayer.swift'
info :0: note: filenames are used to distinguish private declarations with the same name
info Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
Lottie-react-native @ 3.0.3
React-native @ 0.59.8
FIXED!
Problem comes through the installation. No need to write npm i --save lottie-ios@3.0.3
because npm i --save lottie-react-native
package has lottie-ios package inside node_modules. Therefore, when you write react-native link lottie-ios
it ruins and duplicates everything.
So, the installation must be (for 0.59):
- Remove from node_modules / unlink all lottie files;
- Write
npm i --save lottie-react-native
; - Go to project/node_modules/lottie-react-native/node_modules;
- Cut lottie-ios folder and paste it into the project node_modules folder near lottie-react-native;
- Write
react-native link lottie-ios && react-native link lottie-react-native
That's it! :)
I'm glad for you :)
What about 0.60> ? There's no react-native link, I just add the packages with yarn, pod istall, and no way to build the project.. so sad.
@brascene are you having any issues? There's no react-native link
needed in RN 0.60
@brascene Just try to do all steps, except fifth. React-Native 0.60 has auto-linking.
Thank you guys for quick support, and yeah @emilioicai I have issue that I cannot build iOS project after following simple installation guide:
yarn add lottie-react-native
,yarn add lottie-ios@3.0.3
pod install
There was like kilometer long error like nothing is working xD I've tried to delete pods, and node modules etc. but no progress still. When I run the app from terminal with react-native run-ios command I get that long error, and when I run the app from XCode directly, there're two errors, one of them was fatal error: module map file... etc.
.
Currently (after deleting and installing again, clearing derived data, pods, and node modules), now I have 100 errors (all complaining about Undefined symbol
and many warnings related with Could not find autolinked library).
@LPranulis
lottie-ios@
node_module is already inside project's node_modules, so all your steps are covered with above two commands..
I have no idea what happend the first time I added this to my project, now I can't run it even without lottie..
@brascene Not related to auto linking at all but did you try adding a swift file as suggested here? https://stackoverflow.com/a/56176956/3265176
I'll give it a try in a moment
OMG it's working :) #513
This is what magically make it work:
$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)
I hope Android won't have similar issue..
Thanks again for very quick support! And thanks for Lottie!
there's something in lottie-ios project under the project.pbxproj file where
on line 639 and line 676 TextCompositionLayer.swift
is included twice
EDIT: actually it's being referenced twice all over
EDIT: and is fixed airbnb/lottie-ios@3fd8df1#diff-3145c4e4052f34ea1c3a594af502d418 by this commit with version 3.0.6 I believe
@LPranulis i don't have anything inside lottie-react-native's node_modules, it's just an empty folder. Im using RN 0.60.4 and no cocoapods. Any help?
I made it work, it took me so many hours but finally. Had to add some stuff on react-native-lottie
OMG it's working :) #513 This is what magically make it work:
$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)
I hope Android won't have similar issue.. Thanks again for very quick support! And thanks for Lottie!
Where should I add that??