Closed FaisalTechDots closed 11 months ago
I am also having same issue since couple of days. When I install both react-native-firebase/firestore and react-native-firebase/messaging at the same time, applications builds on Android but creating above mentioned issue on iOS side. Can any one please share some possible workaround?
@shani293 and @FaisalTechDots the workaround is not to use modular headers
This - use_modular_headers!
is not valid as far as I know.
You have to do use_frameworks! :linkage => static
as required by firebase-ios-sdk underlying
This is a known thing, it is documented, and will not be resolved by any change here - it is a user build issue - so this will be closed as not actionable
use_frameworks! :linkage => static
=> use_frameworks! :linkage => :static
additional information
:flipper_configuration => flipper_config
in your PodFile I am facing the same issue currently. Have you found any solution to it?
@rangelkoli when people post "I am facing the same issue" it implies they have read the full issue including all associated files and they have the exact same files and exact same issue behavior.
So you need to use use_frameworks! :linkage => :static
as, if you are having the same issue, you have the same incorrect Podfile contents.
Which is what this issue discusses
@mikehardy this is my podfile :
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, min_ios_version_supported
use_modular_headers!
prepare_react_native_project!
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
# dependencies: {
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
$RNMapboxMapsImpl = 'mapbox'
target 'Scartaste_Mobile' do
config = use_native_modules!
# Flags change depending on the env values.
flags = get_default_flags()
#pod 'RNFBFirestore', :path => '../node_modules/@react-native-firebase/firestore'
pod 'RNFS', :path => '../node_modules/react-native-fs'
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# :hermes_enabled => flags[:hermes_enabled],
:hermes_enabled => false,
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
#:flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'Scartaste_MobileTests' do
inherit! :complete
# Pods for testing
end
pre_install do |installer|
$RNMapboxMaps.pre_install(installer)
end
post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false
)
$RNMapboxMaps.post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
What would be the solution now ? for instance where should I add use_frameworks! :linkage => :static
Either as an environment variable that you use consistently everywhere you good install so the conditional in your podfile works (you can see it in there, yes?) Or in that area but comment out the conditional ruby and just hardcode it. I hardcode it in my apps.
Actually I'm very new to this issue so any example will help
@Alreadywinner you'll have to take some initiative here, we were all new once. My comment was pretty prescriptive, you can search for the string "static" in your podfile and look at it while reading my comment
Absolutely Agreed 👍. Actually I forgot to tell you but I was able to resolve the issue earleir Chat GPT helped me. Thanks for the help 🙂
I commented out all the flipper configurations and linking lines and added
use_frameworks! :linkage => :static
Only and it worked perfect
@mikehardy and for anyone reading this thread the use_modular_headers!
is for when using the Firebase JS WEB SDK when building a react native app with the web app configuration.
Issue
The problem arises when attempting to use @react-native-firebase/firestore. While Android appears to function flawlessly, iOS is presenting the issue described below:
I've been struggling with this issue for over a week now. After successfully running "pod install," I attempted to launch my iOS app from Xcode. However, I'm encountering the following problem:
Error: ### ios/Pods/Headers/Private/openssl_grpc/BoringSSL-GRPC.modulemap' not found
_/Users/mac/Documents/Gitlab/hybrid-app/ios/Pods/gRPC-Core/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c module map file '/Users/mac/Documents/Gitlab/hybrid-app/ios/Pods/Headers/Private/opensslgrpc/BoringSSL-GRPC.modulemap' not found
I'm seeking help to overcome this situation as it's been quite challenging to resolve.
Project Files
Javascript
Click To Expand
#### `package.json`: ```json "dependencies": { "@react-native-async-storage/async-storage": "^1.17.11", "@react-native-community/geolocation": "^3.0.6", "@react-native-firebase/app": "^18.3.0", "@react-native-firebase/firestore": "^18.3.0", "@react-native-firebase/messaging": "^18.3.0", "@react-navigation/bottom-tabs": "^6.5.7", "@react-navigation/material-top-tabs": "^6.6.3", "@react-navigation/native": "^6.1.4", "@react-navigation/native-stack": "^6.9.10", "@reduxjs/toolkit": "^1.9.3", "@rneui/base": "^4.0.0-rc.7", "@rneui/themed": "^4.0.0-rc.7", "axios": "^1.3.4", "country-iso-2-to-3": "^1.1.0", "i18next": "^22.4.11", "lodash": "^4.17.21", "moment": "^2.29.4", "patch-package": "^6.5.1", "postinstall-postinstall": "^2.1.0", "react": "18.2.0", "react-i18next": "^12.2.0", "react-native": "0.72.3", "react-native-actions-sheet": "^0.8.29", "react-native-calendars": "^1.1295.0", "react-native-collapsible": "^1.6.1", "react-native-config": "^1.5.0", "react-native-country-flag": "^1.1.9", "react-native-country-picker-modal": "^2.0.0", "react-native-date-picker": "^4.2.13", "react-native-document-picker": "^9.0.1", "react-native-email-link": "^1.14.5", "react-native-google-maps": "^1.0.0", "react-native-google-places-autocomplete": "^2.5.1", "react-native-gradle-plugin": "^0.71.19", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-linear-gradient": "^2.6.2", "react-native-maps": "^1.7.1", "react-native-modal": "^13.0.1", "react-native-pager-view": "^6.2.0", "react-native-phone-number-input": "^2.1.0", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "^4.5.0", "react-native-screens": "^3.20.0", "react-native-splash-screen": "^3.3.0", "react-native-star-rating-widget": "^1.7.1", "react-native-svg": "^13.8.0", "react-native-swiper": "^1.6.0", "react-native-tab-view": "^3.5.2", "react-native-vector-icons": "^9.2.0", "react-native-webview": "^13.2.3", "react-native-youtube-iframe": "^2.2.2", "react-query": "^3.39.3", "react-redux": "^8.0.5", "redux-persist": "^6.0.0", "redux-thunk": "^2.4.2", "update": "^0.7.4" }, ``` #### `firebase.json` for react-native-firebase v6: ```json "@react-native-firebase/app": "^18.3.0", "@react-native-firebase/firestore": "^18.3.0", "@react-native-firebase/messaging": "^18.3.0", ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [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' use_modular_headers! pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false platform :ios, '13.0' prepare_react_native_project! # Force pods to match minimum iOS version for React Native # Fixes build issue on Xcode Cloud where some pods # Use iOS 12 calls despite being set as iOS 11 def __apply_Xcode_14_3_RC_post_install_workaround(installer) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] minimum_target = min_ios_version_supported if current_target.to_f < minimum_target.to_f config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_target end end end end # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded # # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js` # ```js # module.exports = { # dependencies: { # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), # ``` flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path target 'soul_artist' do config = use_native_modules! # Flags change depending on the env values. flags = get_default_flags() pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon' rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-maps', :path => rn_maps_path use_react_native!( :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. # Upcoming versions of React Native may rely on get_default_flags(), but # we make it explicit here to aid in the React Native upgrade process. :hermes_enabled => flags[:hermes_enabled], :fabric_enabled => flags[:fabric_enabled], # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. # :flipper_configuration => flipper_config, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'soul_artistTests' do inherit! :complete # Pods for testing end post_install do |installer| react_native_post_install( installer, # Set `mac_catalyst_enabled` to `true` in order to apply patches # necessary for Mac Catalyst builds :mac_catalyst_enabled => false ) __apply_Xcode_12_5_M1_post_install_workaround(installer) __apply_Xcode_14_3_RC_post_install_workaround(installer) end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import
#import
#import "RNSplashScreen.h"
#import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[GMSServices provideAPIKey:@"AIzaSyCFbZ6ymkHH3vbQGO_ZRDji7jfFvkjl6Hg"];
self.moduleName = @"soul_artist";
[FIRApp configure];
// 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 = @{};
[super application:application didFinishLaunchingWithOptions:launchOptions];
[RNSplashScreen show];
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled
{
return true;
}
@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 // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. ndkVersion = "23.1.7779620" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle:7.3.1") classpath("com.facebook.react:react-native-gradle-plugin") classpath 'com.google.gms:google-services:4.3.15' } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" apply plugin: 'com.google.gms.google-services' apply plugin: "com.facebook.react" apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" import com.android.build.OutputFile /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. */ react { /* Folders */ // The root of your project, i.e. where "package.json" lives. Default is '..' // root = file("../") // The folder where the react-native NPM package is. Default is ../node_modules/react-native // reactNativeDir = file("../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen // codegenDir = file("../node_modules/react-native-codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js // cliFile = file("../node_modules/react-native/cli.js") /* Variants */ // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. // debuggableVariants = ["liteDebug", "prodDebug"] /* Bundling */ // A list containing the node command and its flags. Default is just 'node'. // nodeExecutableAndArgs = ["node"] // // The command to run when bundling. By default is 'bundle' // bundleCommand = "ram-bundle" // // The path to the CLI configuration file. Default is empty. // bundleConfig = file(../rn-cli.config.js) // // The name of the generated asset file containing your JS bundle // bundleAssetName = "MyApplication.android.bundle" // // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' // entryFile = file("../js/MyApplication.android.js") // // A list of extra flags to pass to the 'bundle' commands. // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle // extraPackagerArgs = [] /* Hermes Commands */ // The hermes compiler command to run. By default it is 'hermesc' // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] } /** * Set this to true to create four separate APKs instead of one, * one for each native architecture. This is useful if you don't * use App Bundles (https://developer.android.com/guide/app-bundle/) * and want to have separate APKs to upload to the Play Store. */ def enableSeparateBuildPerCPUArchitecture = false /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+' /** * Private function to get the list of Native Architectures you want to build. * This reads the value from reactNativeArchitectures in your gradle.properties * file and works together with the --active-arch-only flag of react-native run-android. */ def reactNativeArchitectures() { def value = project.getProperties().get("reactNativeArchitectures") return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } android { ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion namespace "com.soul_artist" defaultConfig { applicationId "com.soul_artist" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" manifestPlaceholders = [ GOOGLE_API_KEY: "$System.env.GOOGLE_MAP_API_KEY" ] } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include (*reactNativeArchitectures()) } } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } release { storeFile file('your_key_name.keystore') storePassword 'android' keyAlias 'your_key_alias' keyPassword 'android' } } buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://developer.android.com/studio/build/configure-apk-splits.html // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = defaultConfig.versionCode * 1000 + versionCodes.get(abi) } } } } dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation project(':react-native-vector-icons') implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0") implementation project(path: ":@react-native-firebase_messaging") implementation project(':react-native-document-picker') debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.squareup.okhttp3', module:'okhttp' } debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } // implementation(project(':react-native-onesignal')){ // exclude group: 'com.google.android.gms' // } implementation(project(':react-native-maps')){ exclude group: 'com.google.android.gms' } implementation 'com.google.android.gms:play-services-base:18.0.1' implementation 'com.google.android.gms:play-services-location:19.0.1' implementation 'com.google.android.gms:play-services-maps:18.0.2' } project.ext.vectoricons = [ iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf', 'Ionicons.ttf', 'Feather.ttf', 'Fontisto.ttf', 'FontAwesome.ttf', 'FontAwesome5.ttf', 'Entypo.ttf', 'MaterialCommunityIcons.ttf', 'AntDesign.ttf' ] ] project.ext.envConfigFiles = [ debug: ".env", release: ".env" ] project.ext.react = [ enableHermes: false, // Change this value to false ] apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'soul_artist' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' includeBuild('../node_modules/react-native-gradle-plugin') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') include ':@react-native-firebase_messaging' project(':@react-native-firebase_messaging').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/messaging/android') include ':react-native-document-picker' project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-picker/android') ``` #### `MainApplication.java`: ```java package com.soul_artist; import android.os.Bundle; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactActivityDelegate; import org.devio.rn.splashscreen.SplashScreen; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "soul_artist"; } /** * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React * (aka React 18) with two boolean flags. */ @Override protected ReactActivityDelegate createReactActivityDelegate() { return new DefaultReactActivityDelegate( this, getMainComponentName(), // If you opted-in for the New Architecture, we enable the Fabric Renderer. DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18). DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled ); } @Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this); super.onCreate(null); } } ``` #### `AndroidManifest.xml`: ```xml
```
Environment
Click To Expand
**`react-native info` output:** ``` ios/Pods/Headers/Private/openssl_grpc/BoringSSL-GRPC.modulemap' not found ``` - **Platform that you're experiencing the issue on**: - [ ] 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:** - `e.g. 18.3.0` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - No I'm using JavaScript
React Native Firebase
andInvertase
on Twitter for updates on the library.