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.74k stars 2.22k forks source link

[🐛] 🔥 Error: CocoaPods could not find compatible versions for pod "FirebaseCore" on build #8062

Closed notnavindu closed 1 month ago

notnavindu commented 1 month ago

Issue

Hello!

I am currently working on an expo project with react-native-firebase.

A bit of background context: I recently ran into this issue after upgrading my MacOS and xcode versions. Initially, I tried to fix the problem using the plugin approach mentioned here.

Unfortunately it was giving me the following error and failed.

Initial error

``` ⚠️ (../../../../../../../../../Users/notnavindu/Library/Developer/Xcode/DerivedData/bumpedIn-erswbkabttgwavfrsjsjnqflnjjj/Build/Intermediates.noindex/ArchiveIntermediates/bumpedIn/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/ExpoModulesCore.framework/Headers/EXNativeModulesProxy.h:35:60) 33 | - (nonnull instancetype)initWithCustomModuleRegistry:(nonnull EXModuleRegistry *)moduleRegistry; 34 | > 35 | - (void)callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNameOrKey arguments:(NSArray *)arguments resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject; | ^ pointer is missing a nullability type specifier [-Wnullability-completeness] 36 | 37 | @end 38 | ```

The above error occurred on expo SDK 50 and react-native-firebase V19. As per this comment i decided to upgrade my packages hoping to fix the issue.

I upgraded all my packages and expo to their latest versions. (versions shown below)

When I try to build the project I get the following error

❯ yarn prebuild
yarn run v1.22.21
warning icebreaker-mobile@1.6.0: The engine "pnpm" appears to be invalid.
$ npx expo prebuild --clean
env: load .env.local .env.development
env: export EXPO_PUBLIC_API_URL_ANDROID EXPO_PUBLIC_API_URL_IOS EXPO_PUBLIC_MAPS_API_KEY EXPO_PUBLIC_WEB_CLIENT_ID EXPO_PUBLIC_INSTAGRAM_APP_ID
Warning! Your git working tree is dirty.
It's recommended to commit all your changes before proceeding, so you can revert the changes made by this command if necessary.

✔ Would you like to proceed? … yes

✔ Cleared android, ios code
✔ Created native directories
✔ Updated package.json | no changes
✔ Finished prebuild
⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: CocoaPods could not find compatible versions for pod "FirebaseCore":
  In Podfile:
    RNFBApp (from `../node_modules/@react-native-firebase/app`) was resolved to 21.0.0, which depends on
      Firebase/CoreOnly (= 11.2.0) was resolved to 11.2.0, which depends on
        FirebaseCore (= 11.2.0)

    RNFBMessaging (from `../node_modules/@react-native-firebase/messaging`) was resolved to 21.0.0, which depends on
      FirebaseCoreExtension was resolved to 10.23.0, which depends on
        FirebaseCore (~> 10.0)

pod install --repo-update --ansi exited with non-zero code: 1
✨  Done in 170.83s.

The error is there for all prebuild, run:ios and eas build --platform ios commands

npx expo-doctor output:

Dependencies are up to date
❯ npx expo-doctor
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for issues with metro config
✔ Check if the project meets version requirements for submission to app stores
✔ Check npm/ yarn versions
✔ Check for app config fields that may not be synced in a non-CNG project
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check native tooling versions
✔ Check that packages match versions required by installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project!

npx expo install --fix output:

image

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "mobile-app", "main": "expo-router/entry", "version": "1.6.0", "scripts": { "ts:check": "tsc", "start": "yarn env:copy:dev && expo start", "start:clean": "yarn env:copy:dev && expo start --clear", "start:qa": "yarn env:copy:qa && expo start", "start:qa:clean": "yarn env:copy:qa && expo start --clear", "android": "yarn env:copy:dev && expo run:android", "ios": "expo run:ios", "ios:prod:dev": "cross-env APP_VARIANT=production NODE_ENV=production && expo run:ios ", "lint": "eslint .", "prebuild": "npx expo prebuild --clean", "lint:fix": "eslint . --fix", "format": "prettier --check .", "format:fix": "prettier --write .", "env:copy:dev": "shx cp .env.development .env.local", "env:copy:qa": "shx cp .env.qa .env.local", "env:copy:prod": "shx cp .env.production .env.local", "build:local:apk": "eas build -p android --profile apk --local ", "build:local:ios:dev": "eas build --platform ios --local --profile development", "build:local:ios:production": "cross-env EAS_LOCAL_BUILD_SKIP_CLEANUP=1 && eas build --platform ios --local --profile production" }, "jest": { "preset": "jest-expo" }, "dependencies": { "@hookform/resolvers": "^3.3.4", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-community/datetimepicker": "8.0.1", "@react-native-community/netinfo": "11.3.1", "@react-native-firebase/app": "^21.0.0", "@react-native-firebase/auth": "^21.0.0", "@react-native-firebase/messaging": "^21.0.0", "@react-native-firebase/storage": "^21.0.0", "@react-native-google-signin/google-signin": "^13.1.0", "@react-navigation/native": "^6.0.2", "@shopify/flash-list": "1.6.4", "@skillnation/react-native-firebase-hooks": "^0.5.0", "@tamagui/animations-moti": "^1.108.2", "@tamagui/config": "^1.108.2", "@tamagui/metro-plugin": "^1.108.2", "@tamagui/popover": "^1.108.2", "ably": "^1.2.48", "android": "^0.0.8", "axios": "^1.6.2", "compare-versions": "^6.1.0", "dayjs": "^1.11.10", "expo": "^51.0.38", "expo-apple-authentication": "^6.4.2", "expo-build-properties": "~0.12.5", "expo-clipboard": "~6.0.3", "expo-device": "~6.0.2", "expo-document-picker": "~12.0.2", "expo-file-system": "~17.0.1", "expo-font": "~12.0.10", "expo-image-picker": "~15.0.7", "expo-intent-launcher": "~11.0.1", "expo-linear-gradient": "~13.0.2", "expo-linking": "~6.3.1", "expo-location": "~17.0.1", "expo-notifications": "~0.28.18", "expo-router": "~3.5.23", "expo-splash-screen": "~0.27.6", "expo-status-bar": "~1.12.1", "expo-system-ui": "~3.0.7", "expo-task-manager": "~11.8.2", "http-status-codes": "^2.3.0", "lodash": "^4.17.21", "lucide-react-native": "^0.295.0", "nanoid": "^5.0.6", "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.50.1", "react-native": "0.74.5", "react-native-circular-progress": "^1.3.9", "react-native-element-dropdown": "^2.10.2", "react-native-fast-image": "^8.6.3", "react-native-fbsdk-next": "^13.1.3", "react-native-gesture-handler": "~2.16.1", "react-native-instagram-login": "^2.0.6", "react-native-linear-gradient": "^2.8.3", "react-native-mime-types": "^2.5.0", "react-native-mmkv": "^2.12.1", "react-native-radial-gradient": "^1.1.4", "react-native-reanimated": "~3.10.1", "react-native-root-toast": "^3.5.1", "react-native-safe-area-context": "4.10.5", "react-native-screens": "3.31.1", "react-native-svg": "15.2.0", "react-native-video": "^6.4.3", "react-native-web": "~0.19.6", "react-native-webview": "13.8.6", "react-query": "^3.39.3", "rn-tinder-card": "^1.7.0", "tamagui": "1.108.2", "yup": "^1.3.3", "zustand": "^4.4.7" }, "devDependencies": { "@babel/core": "^7.20.0", "@react-native-community/eslint-config": "^3.2.0", "@react-native/eslint-config": "^0.72.2", "@types/lodash": "^4.14.202", "@types/react": "~18.2.14", "@typescript-eslint/eslint-plugin": "^6.14.0", "cross-env": "^7.0.3", "eslint": "^8.19.0", "eslint-config-prettier": "^9.0.0", "eslint-import-resolver-typescript": "^3.6.0", "eslint-plugin-import": "^2.28.1", "eslint-plugin-jest": "^27.6.0", "eslint-plugin-prettier": "^5.0.1", "husky": "^8.0.3", "jest": "^29.2.1", "jest-expo": "~51.0.4", "prettier": "^3.1.1", "react-native-svg-transformer": "^1.3.0", "react-test-renderer": "18.2.0", "shx": "^0.3.4", "typescript": "~5.3.3" }, "overrides": { "react-refresh": "~0.14.0" }, "resolutions": { "react-refresh": "~0.14.0" }, "private": true, "engines": { "npm": "Unsupported. Use Yarn instead.", "pnpm": "Unsupported. Use Yarn instead.", "yarn": ">= 1.22.00", "node": ">= 16.17.0" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") require 'json' podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] use_autolinking_method_symbol = ('use' + '_native' + '_modules!').to_sym origin_autolinking_method = self.method(use_autolinking_method_symbol) self.define_singleton_method(use_autolinking_method_symbol) do |*args| if ENV['EXPO_UNSTABLE_CORE_AUTOLINKING'] == '1' Pod::UI.puts('Using expo-modules-autolinking as core autolinking source'.green) config_command = [ 'node', '--no-warnings', '--eval', 'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))', 'react-native-config', '--json', '--platform', 'ios' ] origin_autolinking_method.call(config_command) else origin_autolinking_method.call() end end platform :ios, podfile_properties['ios.deploymentTarget'] || '13.4' install! 'cocoapods', :deterministic_uuids => false prepare_react_native_project! target 'bumpedIn' do use_expo_modules! config = use_native_modules! use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] use_react_native!( :path => config[:reactNativePath], :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/..", :privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false', ) post_install do |installer| # Fix BoringSSL-GRPC issue unsupported option '-G' # Reason: BoringSSL-GRPC doesn't compatible with Xcode 16 # https://github.com/invertase/react-native-firebase/issues/8020?fbclid=IwY2xjawFc9KxleHRuA2FlbQIxMQABHenJMPNnLPuWcojthZjTcuIvoSKes2ATG69IuneRy2bUjAH3J2nYr-5nlQ_aem_XnJhQUj0eNzBy5xl6kjfmw#issuecomment-2359198907 installer.pods_project.targets.each do |target| if target.name == 'BoringSSL-GRPC' target.source_build_phase.files.each do |file| if file.settings && file.settings['COMPILER_FLAGS'] flags = file.settings['COMPILER_FLAGS'].split flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' } file.settings['COMPILER_FLAGS'] = flags.join(' ') end end end end react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false, :ccache_enabled => podfile_properties['apple.ccacheEnabled'] == 'true', ) # This is necessary for Xcode 14, because it signs resource bundles by default # when building for devices. installer.target_installation_results.pod_target_installation_results .each do |pod_name, target_installation_result| target_installation_result.resource_bundle_targets.each do |resource_bundle_target| resource_bundle_target.build_configurations.each do |config| config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' end end end end post_integrate do |installer| begin expo_patch_react_imports!(installer) rescue => e Pod::UI.warn e end end end ``` #### `AppDelegate.mm`: ```objc #import "AppDelegate.h" #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // @generated begin @react-native-firebase/app-didFinishLaunchingWithOptions - expo prebuild (DO NOT MODIFY) sync-ecd111c37e49fdd1ed6354203cd6b1e2a38cccda [FIRApp configure]; // @generated end @react-native-firebase/app-didFinishLaunchingWithOptions self.moduleName = @"main"; // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{}; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { return [self bundleURL]; } - (NSURL *)bundleURL { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } // Linking API - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options]; } // Universal Links - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { return [super application:application didFailToRegisterForRemoteNotificationsWithError:error]; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] 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 ```


Environment

Click To Expand

**`react-native info` output:** ``` ❯ npx react-native info info Fetching system and libraries information... System: OS: macOS 15.0 CPU: (8) arm64 Apple M1 Memory: 101.08 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.10.0 path: ~/.nvm/versions/node/v20.10.0/bin/node Yarn: version: 1.22.21 path: ~/.nvm/versions/node/v20.10.0/bin/yarn npm: version: 10.2.3 path: ~/.nvm/versions/node/v20.10.0/bin/npm Watchman: Not Found Managers: CocoaPods: version: 1.15.2 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 24.0 - iOS 18.0 - macOS 15.0 - tvOS 18.0 - visionOS 2.0 - watchOS 11.0 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.11090377 Xcode: version: 16.0/16A242d path: /usr/bin/xcodebuild Languages: Java: version: 21.0.3 path: /usr/bin/javac Ruby: version: 3.3.2 path: /opt/homebrew/opt/ruby/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.74.5 wanted: 0.74.5 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: Not found newArchEnabled: false ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [x] **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:** - `21.0.0` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - Y: 5.3.3


mikehardy commented 1 month ago

doesn't seem like this is needed any more?


    # Fix BoringSSL-GRPC issue unsupported option '-G'
    # Reason: BoringSSL-GRPC doesn't compatible with Xcode 16
    # https://github.com/invertase/react-native-firebase/issues/8020?fbclid=IwY2xjawFc9KxleHRuA2FlbQIxMQABHenJMPNnLPuWcojthZjTcuIvoSKes2ATG69IuneRy2bUjAH3J2nYr-5nlQ_aem_XnJhQUj0eNzBy5xl6kjfmw#issuecomment-2359198907
    installer.pods_project.targets.each do |target|
      if target.name == 'BoringSSL-GRPC'
        target.source_build_phase.files.each do |file|
          if file.settings && file.settings['COMPILER_FLAGS']
            flags = file.settings['COMPILER_FLAGS'].split
            flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
            file.settings['COMPILER_FLAGS'] = flags.join(' ')
          end
        end
      end
end

Not sure why it's pulling in the wrong dependencies.

The RNFBMessaging.podspec specifies an unversioned transitive dependency on FirebaseCoreExtension here:

https://github.com/invertase/react-native-firebase/blob/9c940857a3759f85fad2f8d995b83f7c08058d6b/packages/messaging/RNFBMessaging.podspec#L42

It does so because that dep is not always at the same version upstream, despite being current - it has been like this since v19.1 or so around here https://github.com/invertase/react-native-firebase/commit/cb7ed0eb15758a4324d2ce785513a48bfe54fe1e

Perhaps you just need to do a pod repo update, I'm not sure

This does not reproduce in any build testing I've ever done so I'm unsure

notnavindu commented 1 month ago

Hey thanks for the response @mikehardy. The boringSSL part was a mistake and I removed it, along with doing a pod repo update. Issue still exists.

I also tried updating brew, cocoapods, and npx react-native-clean-project.

Also just tried to add this back in but nope.

s.dependency          'FirebaseCoreExtension', firebase_sdk_version

I didn't wanna mess with Podfiles too much as I am not very familiar with it :/

mikehardy commented 1 month ago

Something else must be pinning it somehow. All I can say is our e2e app, my work app, .and if you Google mikehardy rnfbdemo my build demonstrator are all fine

notnavindu commented 1 month ago

Hey it was an error on our end, these pods were pinned in the app.config.js some time ago for reasons I cannot remember :/ it is working now. Thanks for the help!