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

[🐛] XCode 15 build fail - Image Notifcation #7360

Closed AlirezaHadjar closed 10 months ago

AlirezaHadjar commented 1 year ago

Issue

Hi, I updated my Xcode to v15 today and couldn't build my project.

Here is the error:

Cycle inside Riptide; building could produce unreliable results.
Cycle details:
→ Target 'Riptide': ExtractAppIntentsMetadata
○ Target 'Riptide' has copy command from '/Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/ImageNotification.appex' to '/Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/PlugIns/ImageNotification.appex'
○ That command depends on command in Target 'Riptide': script phase “[CP-User] [RNFB] Core Configuration”
○ Target 'Riptide' has process command with output '/Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/Info.plist'
○ Target 'Riptide' has copy command from '/Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/ImageNotification.appex' to '/Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/PlugIns/ImageNotification.appex'

Raw dependency cycle trace:

target:  ->

node: <all> ->

command: <all> ->

node: /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Intermediates.noindex/Riptide.build/Debug-iphonesimulator/Riptide.build/Objects-normal/arm64/ExtractedAppShortcutsMetadata.stringsdata ->

command: P0:target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:ExtractAppIntentsMetadata ->

node: <target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase10-copy-files> ->

command: P0:::Gate target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase10-copy-files ->

node: <Copy /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/PlugIns/ImageNotification.appex> ->

CYCLE POINT ->

command: P0:target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:Copy /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/PlugIns/ImageNotification.appex /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/ImageNotification.appex ->

node: <target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase9--cp-user---rnfb--core-configuration> ->

command: P0:::Gate target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6--fused-phase9--cp-user---rnfb--core-configuration ->

node: <execute-shell-script-c12bf60733e9889b0cc442e23fb46d16a1a033bb772373df0ada893029e9f8c2-target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6-> ->

command: P2:target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:PhaseScriptExecution [CP-User] [RNFB] Core Configuration /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Intermediates.noindex/Riptide.build/Debug-iphonesimulator/Riptide.build/Script-EAD5AB8848DC6DCFFEA1BCD7.sh ->

node: /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/Info.plist/ ->

directoryTreeSignature: � ->

directoryContents: /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/Info.plist ->

node: /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/Info.plist ->

command: P0:target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:ProcessInfoPlistFile /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/Info.plist /Users/alirezahadjar/Desktop/Projects/ReactNative/riptide-react-native/ios/Riptide/Info.plist ->

node: /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/PlugIns/ImageNotification.appex ->

command: P0:target-Riptide-c12bf60733e9889b0cc442e23fb46d167ceb6b36bcfc2fb90f69ac96de4975d6-:Debug:Copy /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/Riptide.app/PlugIns/ImageNotification.appex /Users/alirezahadjar/Library/Developer/Xcode/DerivedData/Riptide-cypxxjmcdhuawtekhxcvgearuuro/Build/Products/Debug-iphonesimulator/ImageNotification.appex

Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "au.com.riptidemag.app", "version": "0.0.1", "private": true, "scripts": { "lint": "eslint .", "start": "react-native start", "test": "jest", "prepare": "husky install", "start:reset-cache": "react-native start --reset-cache", "configure:port": "adb reverse tcp:8081 tcp:8081", "android": "react-native run-android --mode=developmentDebug", "android:dev": "react-native run-android --mode=developmentDebug", "android:dev:release": "react-native run-android --mode=developmentRelease", "android:production": "react-native run-android --mode=productionDebug", "android:production:release": "react-native run-android --mode=productionRelease", "build:android:dev": "cd android && ./gradlew assembleDevelopmentRelease && cd .. && open ./android/app/build/outputs/apk/development/release", "bundle:android:dev": "cd android && ./gradlew bundleDevelopmentRelease && cd .. && open ./android/app/build/outputs/bundle/developmentRelease", "build:android:production": "cd android && ./gradlew assembleProductionRelease && cd .. && open ./android/app/build/outputs/apk/production/release", "bundle:android:production": "cd android && ./gradlew bundleProductionRelease && cd .. && open ./android/app/build/outputs/bundle/productionRelease", "ios": "npx react-native run-ios --scheme Riptide-development", "ios:dev": "npx react-native run-ios --scheme Riptide-development", "ios:dev:release": "npx react-native run-ios --scheme Riptide-development --configuration Release", "ios:production": "npx react-native run-ios --scheme Riptide-production", "ios:production:release": "npx react-native run-ios --scheme Riptide-production --configuration Release", "postinstall": "patch-package && yarn clean-modules && react-native setup-ios-permissions", "clean-modules": "rm -rf ./node_modules/react-native-permissions/{example,node_modules}" }, "expo": { "autolinking": { "exclude": [ "expo-keep-awake", "expo-font", "expo-file-system", "expo-constants", "expo-asset", "expo-application" ] } }, "dependencies": { "@react-native-community/blur": "4.3.2", "@react-native-firebase/analytics": "18.4.0", "@react-native-firebase/app": "18.4.0", "@react-native-firebase/messaging": "18.4.0", "@react-native-firebase/perf": "18.4.0", "@react-native-masked-view/masked-view": "^0.2.9", "@react-navigation/bottom-tabs": "6.5.8", "@react-navigation/elements": "1.3.18", "@react-navigation/material-top-tabs": "6.6.3", "@react-navigation/native": "^6.1.7", "@react-navigation/native-stack": "6.9.13", "@reduxjs/toolkit": "1.9.5", "@sentry/react-native": "5.9.1", "@shopify/flash-list": "^1.6.0", "@tanstack/react-query": "^4.35.3", "axios": "1.5.0", "dayjs": "^1.11.9", "expo": "^49.0.10", "expo-image": "^1.5.1", "formik": "2.4.4", "i18next": "23.5.1", "moment": "^2.29.4", "react": "18.2.0", "react-airplay": "^1.2.0", "react-i18next": "13.2.2", "react-native": "0.72.4", "react-native-awesome-gallery": "^0.3.6", "react-native-bars": "^2.3.0", "react-native-bootsplash": "5.0.2", "react-native-code-push": "8.1.0", "react-native-config": "1.5.1", "react-native-fs": "^2.20.0", "react-native-gesture-handler": "^2.12.1", "react-native-haptic-feedback": "^2.2.0", "react-native-image-crop-picker": "0.40.0", "react-native-keychain": "^8.1.2", "react-native-linear-gradient": "2.8.3", "react-native-mmkv": "^2.10.2", "react-native-modalize": "^2.1.1", "react-native-pager-view": "^6.2.1", "react-native-permissions": "3.9.1", "react-native-portalize": "^1.0.7", "react-native-reanimated": "3.5.2", "react-native-reanimated-carousel": "3.5.1", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "4.7.2", "react-native-screens": "3.25.0", "react-native-skeleton-placeholder": "^5.2.4", "react-native-slider-custom": "^0.11.0", "react-native-svg": "^13.13.0", "react-native-tab-view": "3.5.2", "react-native-toast-message": "^2.1.6", "react-native-version-check": "^3.4.7", "react-native-video": "6.0.0-alpha.7", "react-native-webview": "13.6.0", "react-native-youtube-iframe": "^2.3.0", "react-redux": "8.1.2", "redux": "^4.2.1", "redux-persist": "^6.0.0", "yup": "1.2.0" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/eslint-config": "^0.72.2", "@react-native/metro-config": "^0.72.11", "@tanstack/eslint-plugin-query": "^4.34.1", "@tsconfig/react-native": "^3.0.0", "@types/react": "^18.0.24", "@types/react-native-version-check": "^3.4.5", "@types/react-native-video": "^5.0.15", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.2", "babel-plugin-module-resolver": "^5.0.0", "eslint": "^8.49.0", "eslint-import-resolver-babel-module": "^5.3.2", "eslint-plugin-import": "^2.28.1", "husky": "8.0.3", "jest": "^29.6.2", "lint-staged": "13.2.3", "metro-react-native-babel-preset": "0.76.8", "patch-package": "^8.0.0", "pod-install": "0.1.39", "postinstall-postinstall": "^2.1.0", "prettier": "^2.4.1", "react-native-svg-transformer": "^1.1.0", "react-test-renderer": "18.2.0", "reactotron-react-native": "^5.0.3", "typescript": "5.2.2" }, "engines": { "node": ">=16" }, "lint-staged": { "*.{js,ts,tsx}": "eslint --fix", "*.{js,css,md,json,ts,tsx}": "prettier --write" }, "reactNativePermissionsIOS": [ "AppTrackingTransparency" ] } ``` #### `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") def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', "require.resolve( '#{script}', {paths: [process.argv[1]]}, )", __dir__]).strip end node_require('react-native/scripts/react_native_pods.rb') node_require('react-native-permissions/scripts/setup.rb') $RNFirebaseAsStaticFramework = true platform :ios, '13.0' prepare_react_native_project! setup_permissions([ 'AppTrackingTransparency' ]) # 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 target 'Riptide' do use_expo_modules! post_integrate do |installer| begin expo_patch_react_imports!(installer) rescue => e Pod::UI.warn e end end config = use_native_modules! # Flags change depending on the env values. flags = get_default_flags() use_react_native!( :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. :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}/.." ) pod 'GoogleUtilities', :modular_headers => true pod 'Firebase', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'GoogleDataTransport', :modular_headers => true pod 'FirebaseInstallations', :modular_headers => true pod 'FirebaseCoreExtension', :modular_headers => true pod 'nanopb', :modular_headers => true pod 'RNBootSplash', :path => '../node_modules/react-native-bootsplash' target 'RiptideTests' do inherit! :complete # Pods for testing 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 ) __apply_Xcode_12_5_M1_post_install_workaround(installer) end end target 'ImageNotification' do pod 'GoogleUtilities', :modular_headers => true pod 'Firebase', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'GoogleDataTransport', :modular_headers => true pod 'FirebaseInstallations', :modular_headers => true pod 'FirebaseCoreExtension', :modular_headers => true pod 'nanopb', :modular_headers => true pod 'Firebase/Messaging', '~> 10.14.0' end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import "RNBootSplash.h" #import #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FIRApp configure]; self.moduleName = @"Riptide"; // 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 { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else return [CodePush bundleURL]; #endif } // ⬇️ Add this before file @end - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName initProps:(NSDictionary *)initProps { UIView *rootView = [super createRootViewWithBridge:bridge moduleName:moduleName initProps:initProps]; [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView]; // ⬅️ initialize the splash screen return rootView; } @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 kotlinVersion = "1.8.22" // 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") classpath("com.facebook.react:react-native-gradle-plugin") classpath 'com.google.gms:google-services:4.3.15' classpath 'com.google.firebase:perf-plugin:1.4.2' } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" apply plugin: 'com.google.firebase.firebase-perf' apply plugin: 'com.google.gms.google-services' apply plugin: "com.facebook.react" project.ext.envConfigFiles = [ development: ".env.development", production : ".env.production", ] apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" /** * 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 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:+' apply from: "../../node_modules/@sentry/react-native/sentry.gradle" android { ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion namespace "au.com.riptidemag.app" defaultConfig { applicationId project.env.get("PACKAGE_NAME") minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName project.env.get("VERSION_NAME") flavorDimensions "default" vectorDrawables.useSupportLibrary true } productFlavors { development { } production { } } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } release { if (project.hasProperty('RIPTIDE_UPLOAD_KEY_STORE_FILE')) { storeFile file(RIPTIDE_UPLOAD_KEY_STORE_FILE) storePassword RIPTIDE_UPLOAD_KEY_STORE_PASSWORD keyAlias RIPTIDE_UPLOAD_KEY_ALIAS keyPassword RIPTIDE_UPLOAD_KEY_PASSWORD } } } buildTypes { debug { signingConfig signingConfigs.debug resValue "string", "CodePushDeploymentKey", '""' } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.release resValue "string", "CodePushDeploymentKey", project.env.get("CODEPUSH_ANDROID_DEPLOYMENT_KEY") minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } } dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") 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 } } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'au.com.riptidemag.app' 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 ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle") useExpoModules() ``` #### `MainApplication.java`: ```java package au.com.riptidemag.app; import android.content.res.Configuration; import expo.modules.ApplicationLifecycleDispatcher; import expo.modules.ReactNativeHostWrapper; import android.app.Application; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactNativeHost; import com.facebook.soloader.SoLoader; import java.util.List; import com.microsoft.codepush.react.CodePush; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } @Override protected boolean isNewArchEnabled() { return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; } @Override protected Boolean isHermesEnabled() { return BuildConfig.IS_HERMES_ENABLED; } @Override protected String getJSBundleFile() { return CodePush.getJSBundleFile(); } }); @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { // If you opted-in for the New Architecture, we load the native entry point for this app. DefaultNewArchitectureEntryPoint.load(); } ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); ApplicationLifecycleDispatcher.onApplicationCreate(this); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig); } } ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 13.5.2 CPU: (8) arm64 Apple M1 Pro Memory: 99.92 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.14.2 path: /usr/local/bin/node Yarn: version: 1.22.19 path: /usr/local/bin/yarn npm: version: 9.6.0 path: /usr/local/bin/npm Watchman: version: 2023.09.04.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: API Levels: - "27" - "29" - "30" - "31" - "33" - "33" Build Tools: - 30.0.3 - 33.0.0 - 33.0.2 System Images: - android-28 | Google ARM64-V8a Play ARM 64 v8a - android-33 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10406996 Xcode: version: 15.0/15A240d path: /usr/bin/xcodebuild Languages: Java: version: 11.0.18 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.4 wanted: 0.72.4 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false ``` - **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:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N` & `VERSION`


AlirezaHadjar commented 1 year ago

I followed this https://developer.apple.com/forums/thread/731287?answerId=756374022#756374022 and as a workaround fixed my problem.

Screenshot 2023-09-20 at 12 00 57 PM

mikehardy commented 1 year ago

I'm sorry, I'm not able to support any builds that use workarounds to avoid use_frameworks:


  pod 'GoogleUtilities', :modular_headers => true
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'nanopb', :modular_headers => true
AlirezaHadjar commented 1 year ago

Should I remove the use_frameworks? I didn't know that I should remove it.

williamgurzoni commented 1 year ago

These use_frameworks! and use_modular_headers! are pretty confusing. What is the best source of info to get around this @mikehardy? By the way I'm having a similar issue when trying to upgrade the Firebase and use the use_frameworks!. Thank you.

mikehardy commented 1 year ago

Our install documents, followed by GitHub repo mikehardy/rnfbdemo - the make-demo.sh script in there demonstrates

It's quite simple though, we need 'use_frameworks! :linkage => :static' and that's it. No other things.

AlirezaHadjar commented 1 year ago

Thanks you @mikehardy for the clarification. I changed my Podfile and now it is like this

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
def node_require(script)
  # Resolve script with node to allow for hoisting
  require Pod::Executable.execute_command('node', ['-p',
    "require.resolve(
      '#{script}',
      {paths: [process.argv[1]]},
    )", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

$RNFirebaseAsStaticFramework = true

platform :ios, '13.0'
prepare_react_native_project!

setup_permissions([
  'AppTrackingTransparency'
])

# 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 = flipper_config = FlipperConfiguration.disabled

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

use_frameworks! :linkage => :static

target 'Riptide' do
  use_expo_modules!
  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
  config = use_native_modules!

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

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :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}/.."
  )

  pod 'RNBootSplash', :path => '../node_modules/react-native-bootsplash'

  target 'RiptideTests' do
    inherit! :complete
    # Pods for testing
  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
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

target 'ImageNotification' do
  pod 'Firebase/Messaging', '~> 10.14.0'
end

But I still face the issue I mentioned, but by changing the order of items in my BuildPhase the issue would be resolved.

numandev1 commented 1 year ago

@williamgurzoni @AlirezaHadjar i made a solution for :modular_headers => true https://stackoverflow.com/a/77150112/8079868

@mikehardy can you check if my solution doesn't have any side effects?

AlirezaHadjar commented 1 year ago

@numandev1 The issue I have mentioned differs from the one you're dealing with. At first, I just hadn't followed the exact installation instructions. But now I changed it and the build still fails but not because of the issue you're referring to. it fails because of the Cycle issue

numandev1 commented 1 year ago

@AlirezaHadjar i made a solution to fix Cycle error from [RNFB] Core Configuration and [CP_user][RNFB] Crashlytics Configuration if we are using :modular_headers => true

AlirezaHadjar commented 1 year ago

Thank you @numandev1 for the feedback. Although, my problem only happens if you have configured ImageNotification. Also, I don't think using :modular_headers => true would be the best solution.

mikehardy commented 1 year ago

@numandev1 I appreciate your sharing knowledge, and I hope it helps you and others, however I must continue to reiterate that no support is given for modular_headers-based builds - we require use_frameworks as our underlying firebase-ios-sdk requires use_frameworks, and no other build configurations will be supported here

@AlirezaHadjar you mention this:

But I still face the issue I mentioned, but by changing the order of items in my BuildPhase the issue would be resolved.

Can you be more specific about exactly which items you needed to move around? I wonder if it could be automated, as a manual fix in the project file isn't something we can easily support. But I believe we have solved similar things in the past in a Podfile where build phases were moved around programmatically, specifically I did this to work around a use_frameworks error in the past:

https://github.com/mikehardy/rnfbdemo/commit/c73821853723ab4e59c25c58a1e1bc853c6f3ae4#diff-3e27ae623577d0c559bd8ab973a0c34af8cc65ef9beb9868a9cdb029854f8078R220-R222

AlirezaHadjar commented 1 year ago

@mikehardy I have put a screenshot of the diff of the Build Phases that solved the issue, above in a comment. We need to move Embed Foundation Extensions from the bottom to right after Copy Bundle Resources. Screenshot 2023-09-22 at 9 47 57 PM

mikehardy commented 1 year ago

I'm not sure if this is something we can reason about as far as providing general advice to people unfortunately - obviously it solves your problem which is fantastic, but... should the RNFB build phase always be last (so we could programmatically enforce it) or is that too large an assumption? Would it have worked if your build phase was simply moves one up above RNFB even or did it have to move up as many steps as it did?

Not sure anything would work 100% for everyone which would be a requirement for automation in this repository 🤔

AlirezaHadjar commented 1 year ago

You are right @mikehardy. it only needs to be above RNFB. it worked even when I moved it to right above the RNFB. Screenshot 2023-09-22 at 10 22 40 PM

CarlosMayoralMX commented 1 year ago

@mikehardy I have put a screenshot of the diff of the Build Phases that solved the issue, above in a comment. We need to move Embed Foundation Extensions from the bottom to right after Copy Bundle Resources. Screenshot 2023-09-22 at 9 47 57 PM

At first I thought it was something related to RNFirebase but then I realized it was the ImageNotification, this solution worked for me!

AlirezaHadjar commented 1 year ago

@CarlosMayoralMX it only happens if you have widgets.

Bardiamist commented 1 year ago

Helped this

Screenshot 2023-09-27 at 19 19 59
mikehardy commented 1 year ago

Scanning through this again as I've had a moment to do gardening in this repo and look at all the issues from last couple weeks.

I'm still not sure we can automatically fix this for people as build phase ordering may be custom + quite specific for specific projects.

But! This is clearly a problem (apparently for anyone also using widgets?), and I see from the reactions that a few are interested. We have a tips and tricks page, and there may be some other page on rnfirebase.io / our docs where this could be noted? I'd be happy to merge a PR that tried to help others avoid this pain, I'm just not sure of the best place to put it. Open to suggestion + any reasonable PR here

AlirezaHadjar commented 1 year ago

To update, I couldn't create an archive with my approach. So my method only works for debugging 😅 I had to remove the image notification widget for now.

Bardiamist commented 12 months ago

@AlirezaHadjar Hey, what error are you have?

I also have Firebase with extensions (home screen and lockscreen widgets). Not tried to archive a long time but now it's not archiving.

command failed with exit status 65 (set -o pipefail && xcodebuild "archive" "-workspace" "/Users/[REDACTED]/git/ios/myproj.xcworkspace" "-scheme" "myproj" "-configuration" "Release" "-xcconfig" "/var/folders/47/vv4z818x0k14x2f1nlpd8ktc0000gn/T/2691548353/temp.xcconfig" "-archivePath" "/var/folders/47/vv4z818x0k14x2f1nlpd8ktc0000gn/T/xcodeArchive984168353/myproj.xcarchive" "-destination" "generic/platform=iOS" | xcpretty):
error: File /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/myproj-anwnflguitnmtpdzvggmsmvhofsr/Build/Intermediates.noindex/ArchiveIntermediates/myproj/BuildProductsPath/Release-iphoneos/myproj.app/main.jsbundle does not exist
Bardiamist commented 12 months ago

My today's problem should be not related with Firebase.

Move Embed App Extensions above as here https://github.com/invertase/react-native-firebase/issues/7360#issuecomment-1737285652 works for archive release build.

mikehardy commented 12 months ago

@Bardiamist hey 👋 - I'm not sure where the best place would be in the docs for this so people will be aware of it, but if it is not in there and you (as a user of extensions...) can think of a good spot in the docs, I'd be happy to merge a PR that helped future people

github-actions[bot] commented 11 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.