invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.69k stars 2.21k forks source link

error: redefinition of module 'Firebase' #6304

Closed Bilal-Abdeen closed 2 years ago

Bilal-Abdeen commented 2 years ago

Issue

When I build the project using npx react-native run-ios, I get the following error messages.

To reproduce the error:

  1. npx react-native init test
  2. yarn add @react-native-firebase/app
  3. yarn add @react-native-firebase/auth
  4. Download firebase.json to the project's folder
  5. Xcode > add the package firebase-ios-sdk package from https://github.com/firebase/firebase-ios-sdk.git
  6. Xcode > add the file GoogleService-Info.plist
  7. Xcode > Targets > Info > URL Types > + > add the value of REVERSED_CLIENT_ID, which I got from GoogleService-Info.plist
  8. npx pod-install ios
  9. npx react-native run-ios
    
    /Users/macbilal/macreact/casual_job/test/ios/Pods/Firebase/CoreOnly/Sources/module.modulemap:1:8: error: redefinition of module 'Firebase'
    module Firebase {
       ^
    /Users/macbilal/Library/Developer/Xcode/DerivedData/test-dxkfhcjhlhtazgekeixnrzmjdjaz/SourcePackages/checkouts/firebase-ios-sdk/CoreOnly/Sources/module.modulemap:1:8: note: previously defined here
    module Firebase {
       ^
    ..... <there are more lines, which are similar to the above>
    1 error generated.

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>


3 errors generated.
..... <there are more lines, which are similar to the above>
23 errors generated.

** BUILD FAILED **

The following build commands failed:
    CompileC /Users/macbilal/Library/Developer/Xcode/DerivedData/test-dxkfhcjhlhtazgekeixnrzmjdjaz/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/main.o /Users/macbilal/macreact/casual_job/test/ios/test/main.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'test' from project 'test')
(1 failure)
```
---

## Project Files

<!-- Provide the contents of key project files which will help to debug -->
<!--     For Example: -->
<!--        - iOS: `Podfile` contents. -->
<!--        - Android: `android/build.gradle` contents. -->
<!--        - Android: `android/app/build.gradle` contents. -->
<!--        - Android: `AndroidManifest.xml` contents. -->

<!-- ADD THE CONTENTS OF THE FILES IN THE PROVIDED CODE BLOCKS BELOW -->

### Javascript

<details><summary></summary>
<p>

#### `package.json`:

```json
{
  "name": "test",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-firebase/app": "^14.11.0",
    "@react-native-firebase/auth": "^14.11.0",
    "react": "17.0.2",
    "react-native": "0.68.2"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.67.0",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}
```

#### `firebase.json` for react-native-firebase v6:

```json
{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint"
    ]
  },
  "storage": {
    "rules": "storage.rules"
  },
  "emulators": {
    "auth": {
      "port": 9099
    },
    "functions": {
      "port": 5001
    },
    "firestore": {
      "port": 8080
    },
    "storage": {
      "port": 9199
    },
    "ui": {
      "enabled": true
    }
  },
  "react-native": {
    "crashlytics_ndk_enabled": false,
    "crashlytics_debug_enabled": false,
    "crashlytics_disable_auto_disabler": false,
    "crashlytics_auto_collection_enabled": false,
    "crashlytics_is_error_generation_on_js_crash_enabled": false,
    "crashlytics_javascript_exception_handler_chaining_enabled": false
  }
}

```

</details>

### iOS

<details><summary>Click To Expand</summary>
<p>

#### `ios/Podfile`:

- [x] I'm using Pods and my Podfile looks like:

```ruby
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false

target 'test' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'testTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
```

#### `AppDelegate.m`:

```objc
#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <React/RCTAppSetupUtils.h>

#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <ReactCommon/RCTTurboModuleManager.h>

#import <react/config/ReactNativeConfig.h>

@interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
  RCTTurboModuleManager *_turboModuleManager;
  RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
  std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
  facebook::react::ContextContainer::Shared _contextContainer;
}
@end
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  RCTAppSetupPrepareApp(application);

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];

#if RCT_NEW_ARCH_ENABLED
  _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
  _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
  _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
  _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
  bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
#endif

  UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"test", nil);

  if (@available(iOS 13.0, *)) {
    rootView.backgroundColor = [UIColor systemBackgroundColor];
  } else {
    rootView.backgroundColor = [UIColor whiteColor];
  }

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

#if RCT_NEW_ARCH_ENABLED

#pragma mark - RCTCxxBridgeDelegate

- (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
{
  _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
                                                             delegate:self
                                                            jsInvoker:bridge.jsCallInvoker];
  return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
}

#pragma mark RCTTurboModuleManagerDelegate

- (Class)getModuleClassFromName:(const char *)name
{
  return RCTCoreModulesClassProvider(name);
}

- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
                                                      jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
{
  return nullptr;
}

- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
                                                     initParams:
                                                         (const facebook::react::ObjCTurboModule::InitParams &)params
{
  return nullptr;
}

- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
{
  return RCTAppSetupDefaultModuleFromClass(moduleClass);
}

#endif

@end
```
</p>
</details>

---

### Android

<details><summary>N/A</summary>
<p>

#### Have you converted to AndroidX?

<!--- Mark any options that apply below -->

- [ ] my application is an AndroidX application?
- [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility?
- [ ] I am using the NPM package `jetifier` for react-native compatibility?

#### `android/build.gradle`:

```groovy
// N/A
```

#### `android/app/build.gradle`:

```groovy
// N/A
```

#### `android/settings.gradle`:

```groovy
// N/A
```

#### `MainApplication.java`:

```java
// N/A
```

#### `AndroidManifest.xml`:

```xml
<!-- N/A -->
```

</p>
</details>

---

## Environment

<details><summary>Click To Expand</summary>
<p>

**`react-native info` output:**

<!-- Please run `react-native info` on your terminal and paste the contents into the code block below -->

```
System:
    OS: macOS 12.0.1
    CPU: (4) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 4.90 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.15.0 - /usr/local/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 8.5.5 - /usr/local/bin/npm
    Watchman: 2022.06.06.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.68.2 => 0.68.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
```

<!-- change `[ ]` to `[x]` to select an option(s) -->

- **Platform that you're experiencing the issue on**:
  - [ x] iOS
  - [ ] Android
  - [ ] **iOS** but have not tested behavior on Android
  - [ ] **Android** but have not tested behavior on iOS
  - [ ] Both
- **`react-native-firebase` version you're using that has this issue:**
  - `14.11.0`
- **`Firebase` module(s) you're using that has the issue:**
  - `Auth`
- **Are you using `TypeScript`?**
  - `N` 

</p>
</details>

<!-- Thanks for reading this far down ❤️  -->
<!-- High quality, detailed issues are much easier to triage for maintainers -->

<!-- For bonus points, if you put a 🔥 (:fire:) emojii at the start of the issue title we'll know -->
<!-- that you took the time to fill this out correctly, or, at least read this far -->

---

- 👉 Check out [`React Native Firebase`](https://twitter.com/rnfirebase) and [`Invertase`](https://twitter.com/invertaseio) on Twitter for updates on the library.
mikehardy commented 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?

Bilal-Abdeen commented 2 years ago

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.

mikehardy commented 2 years ago

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

Bilal-Abdeen commented 2 years ago

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.

mikehardy commented 2 years ago

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

Bilal-Abdeen commented 2 years ago

@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. :)

mikehardy commented 2 years ago

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

synfox commented 2 years ago

@mikehardy Hello,

I am also getting this issue,

image

If I remove this the content of module.map, I get different Error.

image

I tried several of your suggestions in other issues, related to this topic. But can't sort this out.

My react-native-firebase dependencies

image

PODFile

image

Project Build Settings

image

Target Build Setting

image

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.

mikehardy commented 2 years ago

@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

lucca65 commented 2 years ago

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

mikehardy commented 2 years ago

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

UmarFarooqCA commented 2 years ago

Same Issue. any fix?

mikehardy commented 2 years ago

@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.

UmarFarooqCA commented 2 years ago

Ok, thank you @mikehardy

theartificialguy commented 2 years ago

@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.

mikehardy commented 2 years ago

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.

theartificialguy commented 2 years ago

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

mikehardy commented 2 years ago

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.

theartificialguy commented 2 years ago

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 :)

mikehardy commented 2 years ago

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

theartificialguy commented 2 years ago

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 :)

mikehardy commented 2 years ago

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!

theartificialguy commented 2 years ago

@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:

Screenshot 2022-09-18 at 8 22 42 PM

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...

mikehardy commented 2 years ago

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)

deggertsen commented 2 years ago

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.

zaraganja commented 1 year ago

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.

Last-Autumn-Leaf commented 1 year ago

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.

hamzakashifCL commented 1 year ago

i get this error after adding firebase ios sdk package in xcode

farhankhan8800 commented 1 year ago
Screenshot 2023-08-08 at 5 50 40 PM

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

kaelding commented 1 year ago

same errors.

nhatItsforce commented 1 year ago

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

gshoanganh commented 7 months ago

this is my solution: Xcode → click Show the project navigator → click your Project → Package dependencies -> click - (minus).