Closed Bilal-Abdeen closed 2 years ago
Something else must be going on, I have a fully scripted "npx react-native init" to "running app on ios" react-native-firebase demo here:
https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh
Can you read that / all the comments in that script + base work off that and explain how there is a problem here?
Thank you very much for looking into this, and thank you for sharing this informative script.
The error (redefinition of module 'Firebase'
), which I was complaining about, is thrown after adding the firebase-ios-sdk
package using Xcode. I mean the following step.
Xcode
> add the firebase-ios-sdk
package from https://github.com/firebase/firebase-ios-sdk.git
I could not identify which part of your script achieves the same result?! I mean adding the firebase-ios-sdk
package to the project. Would you, please, let me know which statement(s) do that? I would use them to add the firebase-ios-sdk
package to my project, instead of the Xcode GUI.
You simply do not need to add that at any time
React native uses auto linking with cocoapods so our modules' pod spec files are automatically included, and they bring firebase SDKs in for you transitively depending on what modules you install from react-native-firebase
My app is working fine on Android. I wanted to test it on iOS. As soon as the method signInWithPhoneNumber is called, it crashes. It was suggested in the issue #557 to add the firebase-ios-sdk
package using Xcode. Do you have any other suggestions to fix the crash issue?
Edit: I mis-undertood the suggestions on issue #557. Crashing was for a completely different reason.
Standard iOS troubleshooting: get the crash stack trace from the device (or Simulator) when it crashes by launching your app from Xcode. There's no reason to add firebase-ios-sdk directly, and there's no reason it should crash, but a crash trace is always the way to find the problem. You might want to make sure that you have an up to date google services plist downloaded from firebase web console for your project
@mikehardy, Thank you very much for the hint. Running it in Xcode helped in identifying the error. I have no experience in Apple products, and was not sure where to start from. Thank you again. :)
Glad that worked! Apple development can be quite challenging, seems like there is always some new subtle thing to learn, but if you have fixed this crash, you are on your way :-). Good luck with your project
@mikehardy Hello,
I am also getting this issue,
If I remove this the content of module.map, I get different Error.
I tried several of your suggestions in other issues, related to this topic. But can't sort this out.
My react-native-firebase dependencies
PODFile
Project Build Settings
Target Build Setting
Also tried resetting the project using following commands and also cleaned simulator (Iphone 11)
watchman watch-del-all rm -rf yarn.lock package-lock.json node_modules rm -rf android/app/build rm ios/Pods ios/Podfile.lock rm -rf ~/Library/Developer/Xcode/DerivedData npm install && cd ios && pod update
Followed react-native-firebase guideline for AppDelegate. React Native 0.63.4 iOS Development Target 12.0
Nothing seems to be working for me. Please help. I am lost.
@synfox somewhere between the results of this script https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh and your project is a problem I definitely would make no attempt to run this stuff on react-native 0.63.4 though, I don't spend any time trying to troubleshoot on projects lower than maybe 0.68 at this point. The mobile world moves fast, the vendors update the tools quickly and the old stuff breaks as a result with solutions that are just "upgrade". If you want to invest time (and ask for others to invest time) on troubleshooting issues you should do your best to be on current versions so you (and those you ask) are not chasing ghost issues that are already solved
Scrapping the repos looking for solution to this type of build/dependency problems are an awful experience. The base on which those tools are so precarious that its sad to know that several the apps and tools we use are done in such a mess. Our profession is truly lacking in quality as much as it is moving fast.
No rant to this project, nor to the developers, just that this is becoming more a leap of faith than anything else. What you build today is not reproducible in the future, nor the big community of any actual help as everyone is simply lost and confused
I disagree. I thought similarly ("it's all a house of cards, we're doomed") but then I dug in a little deeper, and with the help of a couple things like react-native-clean-project (to clear out the precarious caching at so many levels) and some judicious scripting (https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh) and automated code signing (thank you https://fastlane.tools/) I feel comfortable saying I can reproducibly build the same thing every single time, and I know why it will build. Or to the contrary if it does not build it will fail every single time and I can drive it to an answer.
Sometimes it takes me longer to get to a real answer than it's worth - but it has always been possible if I've got enough time. So I am sanguine now. And progress continues
Same Issue. any fix?
@UmarFarooqCA there will be no updates to this issue, there is no reproduction and thus nothing actionable for this repo. Your project has some sort of issue and you need to investigate more deeply to discover what it is. I provided a script above that creates a new project from scratch and it works, so it's not a problem in this repo that we know of.
Ok, thank you @mikehardy
@mikehardy, Thank you very much for the hint. Running it in Xcode helped in identifying the error. I have no experience in Apple products, and was not sure where to start from. Thank you again. :)
Hi, what was the error can you please specify that? I'm getting the same error but for GoogleSignIn
package.
Not sure what others see, but you might examine Podfile.lock to see who is depending on what. It seems like maybe your GoogleSignIn dep is depending on some unexpected version of firebase directly, somehow, when it shouldn't. I use react-native-firebase together with https://github.com/react-native-google-signin/google-signin though and it works fine and always has for me, so if you need google signin and react-native-firebase there really shouldn't be an issue.
Not sure what others see, but you might examine Podfile.lock to see who is depending on what. It seems like maybe your GoogleSignIn dep is depending on some unexpected version of firebase directly, somehow, when it shouldn't. I use react-native-firebase together with https://github.com/react-native-google-signin/google-signin though and it works fine and always has for me, so if you need google signin and react-native-firebase there really shouldn't be an issue.
I'm using modular firebase sdk i.e. firebase v9 and with that, @eact-native-google-signin/google-signin, it's been 2 days and whatever I do, I get these 2 errors only, 1st one is Redefinition of module 'GoogleSignIn'
and if I don't add GoogleSignIn Package using swift package manager, I get 37 duplicate symbols for architecture x86_64
error.
Can you please help me?
I have also asked a question on SO if it helps... https://stackoverflow.com/q/73698269/11685381
You say "using swift package manager". react-native is a cocoapods ecosystem. I don't believe that's going to work for you and might lead to these problems
npx react-native init MyTestProject
cd MyTestProject
yarn add @react-native-firebase/app
# do the change to AppDelegate.mm for firebase install here
yarn add @react-native-firebase/auth
yarn add @react-native-google-signin/google-signin
it will build I bet.
You say "using swift package manager". react-native is a cocoapods ecosystem. I don't believe that's going to work for you and might lead to these problems
npx react-native init MyTestProject cd MyTestProject yarn add @react-native-firebase/app # do the change to AppDelegate.mm for firebase install here yarn add @react-native-firebase/auth yarn add @react-native-google-signin/google-signin
it will build I bet.
Okay, I will have to replace my implementation from firebase v9
to @react-native-firebase
and remove "firebase": "^9.9.1",
... Then, if it builds, I will let you know :)
I would not do speculative work on the project until you prove to yourself that you can get a "toy" example building that said, firebase-js-sdk v9 / modular JS sdk is not supported here yet, follow #6220
Hey, I got it working :''), so the steps were (in case someone gets stuck like me):-
I removed "firebase": "^9.9.1"
from my rn project and removed Firebase package from XCode, then I installed @react-native-firebase/app
, @react-native-firebase/auth
, @react-native-firebase/firestore
, @react-native-google-signin/google-signin
and then pod install
, then I build the project using XCode and encountered build errors because of Flipper, in order to solve them, I commented the line :flipper_configuration => FlipperConfiguration.enabled,
from Podfile
and no flipper error but couldn't get past this build error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GTMSessionUploadFetcher", referenced from:
objc-class-ref in FirebaseStorage(FIRStorageUploadTask_d5061b1e2b5f1bb249816cc5fc42ff62.o)
"_OBJC_CLASS_$_GTMLogger", referenced from:
objc-class-ref in FirebaseMessaging(GIPReachability_ae5504e4a6a28a1d8997c6f38e8bff8b.o)
"_kGTMSessionUploadFetcherStandardChunkSize", referenced from:
-[FIRStorageUploadTask enqueue] in FirebaseStorage(FIRStorageUploadTask_d5061b1e2b5f1bb249816cc5fc42ff62.o)
"_GTMFetcherStandardUserAgentString", referenced from:
-[FIRAuthBackendRPCIssuerImplementation init] in FirebaseAuth(FIRAuthBackend_ea73237c278bd1b78e1c76db2a16775a.o)
"_OBJC_CLASS_$_GTMSessionFetcher", referenced from:
objc-class-ref in FirebaseStorage(FIRStorageDownloadTask_c390366e83519f6636ca985ecb70e5d0.o)
objc-class-ref in FirebaseStorage(FIRStorage_691ea9ac7cb4d224d37df2ff8a911989.o)
"_OBJC_CLASS_$_GTMSessionFetcherService", referenced from:
objc-class-ref in FirebaseAuth(FIRAuthBackend_ea73237c278bd1b78e1c76db2a16775a.o)
objc-class-ref in FirebaseStorage(FIRStorage_691ea9ac7cb4d224d37df2ff8a911989.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Things I tried to solve it: 1) npx react-native-clean-project, then rebuild. 2) clear pod cache, delete Pods folder and clean build. 3) rm -rf ~/Library/Developer/Xcode/DerivedData and rebuild. (THIS WORKED).
Project and environment config:
"dependencies": {
"@react-native-async-storage/async-storage": "^1.17.7",
"@react-native-firebase/app": "^15.4.0",
"@react-native-firebase/auth": "^15.4.0",
"@react-native-firebase/firestore": "^15.4.0",
"@react-native-google-signin/google-signin": "^8.0.0",
"react": "18.0.0",
"react-native": "0.69.2",
...
},
Thank you @mikehardy :)
Glad you got this working!
Strange to me that this (npx react-native-clean-project, then rebuild) did not work, as it will clear pod cache, delete Pods folder, and delete DerivedData for you. It alone should have worked, but either way, the real proof is in a working build. Nice!
@mikehardy hey, I'm here today, unfortunately, I'm experiencing similar issue but now related to rnfirebase, whenever I try to build, it throws the following build error:
Things I tried: 1) clear pod cache, delete Pods folder and clean build. (didn't work) 2) rm -rf ~/Library/Developer/Xcode/DerivedData and rebuild. (Didn't work this time :( ) 3) npx react-native-clean-project. (didn't work)
I don't know why it is happening now after solving it earlier...
There's a nearly infinite number of ways things can go wrong, and it's simply not efficient to try and troubleshoot each one. What I do instead typically is provide a complete start-from-scratch script that generates a working project for either use as a scaffold or for comparison on how to make things work. I just finished updating it for react-native 0.70.x: https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh
I recommend you run it, and investigate what the Podfile looks like (and why, there are comments in the script explaining each bit)
This solved it for me. https://stackoverflow.com/questions/70760326/flutter-on-ios-redefinition-of-module-firebase Specifically the removing package dependencies in xcode part.
You simply do not need to add that at any time
React native uses auto linking with cocoapods so our modules' pod spec files are automatically included, and they bring firebase SDKs in for you transitively depending on what modules you install from react-native-firebase
yes for me that's true, remove firebase-ios-sdk package , remove it also from Xcode => package dependencies part . then run pod install and then run the project.
This solved it for me. https://stackoverflow.com/questions/70760326/flutter-on-ios-redefinition-of-module-firebase Specifically the removing package dependencies in xcode part.
Thank you ! This worked for me too.
i get this error after adding firebase ios sdk package in xcode
System: OS: macOS 13.0 CPU: (8) arm64 Apple M1 Memory: 115.73 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 20.3.0 - /opt/homebrew/bin/node Yarn: Not Found npm: 9.6.7 - /opt/homebrew/bin/npm Watchman: 2023.06.08.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10406996 Xcode: 14.3/14E222b - /usr/bin/xcodebuild Languages: Java: 11.0.19 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.11 => 0.71.11 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
I tried to downgrade my Xcode version from 14.3 to 14.2 after reading few blogs but still I could not find the solution , a help will be highly appreciated . Thanks
same errors.
You simply do not need to add that at any time
React native uses auto linking with cocoapods so our modules' pod spec files are automatically included, and they bring firebase SDKs in for you transitively depending on what modules you install from react-native-firebase
I solved my issue by removing https://github.com/firebase/firebase-ios-sdk.git Package Dependencies in XCode. Thanks @mikehardy
this is my solution: Xcode → click Show the project navigator → click your Project → Package dependencies -> click - (minus).
Issue
When I build the project using
npx react-native run-ios
, I get the following error messages.To reproduce the error:
npx react-native init test
yarn add @react-native-firebase/app
yarn add @react-native-firebase/auth
firebase.json
to the project's folderfirebase-ios-sdk package
fromhttps://github.com/firebase/firebase-ios-sdk.git
GoogleService-Info.plist
GoogleService-Info.plist
npx pod-install ios
npx react-native run-ios
While building module 'UIKit' imported from /Users/macbilal/macreact/casual_job/test/ios/test/main.m:1: While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8: While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6: While building module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20: In file included from:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/include/dispatch/dispatch.h:64:10: fatal error: could not build module 'os_workgroup'
include <os/workgroup.h>