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

[πŸ›] CocoaPods could not find compatible versions for pod "Firebase/Messaging" #7783

Closed nl-danish closed 6 months ago

nl-danish commented 6 months ago

Issue

Hi Team, This is in regards with a previous issue we've raised (https://github.com/invertase/react-native-firebase/issues/7589)

We started to upgrade the packages, so far we're on 15.0.0, and had a bit difficulty moving forward. I've made the changes to my Podfile accordingly, but whenever i do the pod install in my ios directory, it seem to be giving me this error.

RNFBAnalytics: You may set variable $RNFirebaseAnalyticsWithoutAdIdSupport=true in Podfile to use analytics without ad ids.
[!] CocoaPods could not find compatible versions for pod "Firebase/Messaging":
  In snapshot (Podfile.lock):
    Firebase/Messaging (= 8.15.0, ~> 8.15.0)

  In Podfile:
    Firebase/Messaging (~> 8.15.0)
    RNFBMessaging (from ../node_modules/@react-native-firebase/messaging) was resolved to 15.0.0, which depends on
      Firebase/Messaging (= 9.1.0)

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * changed the constraints of dependency `Firebase/Messaging` inside your development pod `RNFBMessaging`.
   You should run `pod update Firebase/Messaging` to apply changes you've made.

We checked through multiple stack overflow and github issues, but no one seem'd to work. So far, we've tried

  1. pod install --repo-update - It did not work.
  2. Deleting the podfile.lock and pod install --repo-update - It did not work
  3. pod update Firebase/InAppMessaging - It did not work
  4. Changing platform:ios accordingly - It did not work
  5. Commenting the platform:ios line - It did not work

Project Files

Javascript

Click To Expand

#### `package.json`: ```json "@react-native-firebase/analytics": "^15.0.0", "@react-native-firebase/app": "^15.0.0", "@react-native-firebase/crashlytics": "^15.0.0", "@react-native-firebase/in-app-messaging": "^15.0.0", "@react-native-firebase/messaging": "^15.0.0", ``` #### `firebase.json`: ```json { "react-native": { "messaging_android_notification_channel_id": "high-priority", "crashlytics_auto_collection_enabled": true, "crashlytics_debug_enabled": false } } ```

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' $RNFirebaseAsStaticFramework = true platform :ios, '11.0' target 'NewsLaundry' do config = use_native_modules! use_frameworks! use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :hermes_enabled => false ) # Permissions permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary" pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal' # React Native Version Check (for iOS app updates) pod 'react-native-version-check', :path => '../node_modules/react-native-version-check' pod 'react-native-segmented-control', :path => '../node_modules/@react-native-segmented-control/segmented-control' pod 'ReactNativeMoEngage', :path => '../node_modules/react-native-moengage' pod 'ReactNativeMoEngage', :path => '../node_modules/react-native-moengage' pod 'react-native-voice', :path => '../node_modules/@react-native-voice/voice' target 'NewsLaundryTests' 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) end end target 'ImageNotification' do pod 'Firebase/Messaging', '~> 8.15.0' # Version should match the podfile.lock version Refer https://rnfirebase.io/messaging/ios-notification-images end target 'OneSignalNotificationServiceExtension' do pod 'OneSignalXCFramework', '>= 3.4.3', '< 4.0' end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import "RNSplashScreen.h" #import #import #import #import #import #import #import #import #import #import #import "Orientation.h" #ifdef FB_SONARKIT_ENABLED #import #import #import #import #import #import static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } #ifdef FB_SONARKIT_ENABLED InitializeFlipper(application); #endif [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"X-CompanyName-X" initialProperties:nil]; if (@available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; } else { rootView.backgroundColor = [UIColor whiteColor]; } /// @param sdkConfig MoEngageSDKConfig instance for SDK configuration /// @param isSdkEnabled Bool indicating if SDK is Enabled/Disabled /// @param launchOptions Launch Options dictionary /// Initialize MoEngage SDK // MoEngageSDKConfig* sdkConfig = [[MoEngageSDKConfig alloc] initWithAppID:@"GMVS2E3RMBVWMTBWM6MG872Z"]; // sdkConfig.enableLogs = true; // [[MoEngageInitializer sharedInstance] initializeDefaultSDKConfig:sdkConfig andLaunchOptions:launchOptions]; [[MoEngageInitializer sharedInstance] initializeDefaultInstance:launchOptions]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; // [RNSplashScreen show]; return YES; } - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications]) { [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; } return [Orientation getOrientation]; } - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { //Call only if MoEngageAppDelegateProxyEnabled is NO [[MoEngageSDKMessaging sharedInstance] setPushToken:deviceToken]; } -(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { //Call only if MoEngageAppDelegateProxyEnabled is NO [[MoEngageSDKMessaging sharedInstance]didFailToRegisterForPush]; } - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler{ //Call only if MoEngageAppDelegateProxyEnabled is NO [[MoEngageSDKMessaging sharedInstance] userNotificationCenter:center didReceive:response]; //Custom Handling of notification if Any completionHandler(); } - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{ //This is to only to display Alert and enable notification sound completionHandler((UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert )); } - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { BOOL handledFB = [[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]; BOOL handledDeeplinking = [RCTLinkingManager application:app openURL:url options:options]; return handledFB || handledDeeplinking; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [CodePush bundleURL]; #endif } - (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler { [RNBackgroundDownloader setCompletionHandlerWithIdentifier:identifier completionHandler:completionHandler]; } - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; } - (BOOL)application:(UIApplication *)application shouldSaveSecureApplicationState:(NSCoder *)coder { return YES; } - (BOOL)application:(UIApplication *)application shouldRestoreSecureApplicationState:(NSCoder *)coder { return YES; } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ x] my application is an AndroidX application? - [ x] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ x] 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 = "29.0.3" // check for latest version https://developer.android.com/studio/releases/build-tools#kts minSdkVersion = 24 compileSdkVersion = 33 targetSdkVersion = 33 ndkVersion = "20.1.5948944" // supportLibVersion = "27.1.1" googlePlayServicesAuthVersion = "16.0.1" kotlinVersion = "1.6.0" androidXAnnotation = "1.2.0" androidXBrowser = "1.3.0" } repositories { google() jcenter() gradlePluginPortal() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle:7.3.0") classpath('com.google.gms:google-services:4.3.10') classpath("gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]") classpath("com.google.firebase:firebase-crashlytics-gradle:2.8.1") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0") //8.0.0 rn-iap change // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } google() jcenter() maven { url 'https://www.jitpack.io' } mavenCentral() } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' apply plugin: 'com.google.gms.google-services' // <--- this should be the last line apply plugin: 'com.google.firebase.crashlytics' import com.android.build.OutputFile /** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * and bundleReleaseJsAndAssets). * These basically call `react-native bundle` with the correct arguments during the Android build * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ * // the name of the generated asset file containing your JS bundle * bundleAssetName: "index.android.bundle", * * // the entry file for bundle generation. If none specified and * // "index.android.js" exists, it will be used. Otherwise "index.js" is * // default. Can be overridden with ENTRY_FILE environment variable. * entryFile: "index.android.js", * * // https://reactnative.dev/docs/performance#enable-the-ram-format * bundleCommand: "ram-bundle", * * // whether to bundle JS and assets in debug mode * bundleInDebug: false, * * // whether to bundle JS and assets in release mode * bundleInRelease: true, * * // whether to bundle JS and assets in another build variant (if configured). * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants * // The configuration property can be in the following formats * // 'bundleIn${productFlavor}${buildType}' * // 'bundleIn${buildType}' * // bundleInFreeDebug: true, * // bundleInPaidRelease: true, * // bundleInBeta: true, * * // whether to disable dev mode in custom build variants (by default only disabled in release) * // for example: to disable dev mode in the staging build type (if configured) * devDisabledInStaging: true, * // The configuration property can be in the following formats * // 'devDisabledIn${productFlavor}${buildType}' * // 'devDisabledIn${buildType}' * * // the root of your project, i.e. where "package.json" lives * root: "../../", * * // where to put the JS bundle asset in debug mode * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", * * // where to put the JS bundle asset in release mode * jsBundleDirRelease: "$buildDir/intermediates/assets/release", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in debug mode * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in release mode * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", * * // by default the gradle tasks are skipped if none of the JS files or assets change; this means * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to * // date; if you have any other folders that you want to ignore for performance reasons (gradle * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ * // for example, you might want to remove it from here. * inputExcludes: ["android/**", "ios/**"], * * // override which node gets called and with what additional arguments * nodeExecutableAndArgs: ["node"], * * // supply additional arguments to the packager * extraPackagerArgs: [] * ] */ project.ext.react = [ enableHermes: true, // clean and rebuild if changing ] apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/@sentry/react-native/sentry.gradle" apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = true /** * The preferred build flavor of JavaScriptCore. * * 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:+' /** * Whether to enable the Hermes VM. * * This should be set on project.ext.react and mirrored here. If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */ def enableHermes = project.ext.react.get("enableHermes", false); android { ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/ASL2.0' exclude("META-INF/*.kotlin_module") } dexOptions { javaMaxHeapSize "4g" } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } // Dont use versionName 1.0 in future defaultConfig { applicationId "com.newslaundry.android.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 156 versionName "1.0.1" missingDimensionStrategy 'store', 'play' resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis()) // configurations.all { // resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' } // } // For onesignal } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { debug { storeFile file('debug.keystore') storePassword MYAPP_UPLOAD_STORE_PASSWORD keyAlias MYAPP_UPLOAD_KEY_ALIAS keyPassword MYAPP_UPLOAD_KEY_PASSWORD } release { if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) { storeFile file(MYAPP_UPLOAD_STORE_FILE) storePassword MYAPP_UPLOAD_STORE_PASSWORD keyAlias MYAPP_UPLOAD_KEY_ALIAS keyPassword MYAPP_UPLOAD_KEY_PASSWORD } } } 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.release minifyEnabled enableProguardInReleaseBuilds shrinkResources enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" firebaseCrashlytics { nativeSymbolUploadEnabled true unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib' } } } // 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 { // If your app supports Android versions before Ice Cream Sandwich (API level 14) implementation 'com.facebook.fresco:animated-base-support:1.3.0' // moengage inApp implementation("com.moengage:inapp:6.4.2") // For animated GIF support implementation 'com.facebook.fresco:animated-gif:2.5.0' // For WebP support, including animated WebP implementation 'com.facebook.fresco:animated-webp:2.5.0' implementation 'com.facebook.fresco:webpsupport:2.5.0' // For WebP support, without animations implementation 'com.facebook.fresco:webpsupport:2.5.0' implementation fileTree(dir: "libs", include: ["*.jar"]) //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules // implementation 'com.facebook.android:facebook-android-sdk:[8,9)' implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation("androidx.core:core:1.6.0") implementation ("androidx.appcompat:appcompat:1.3.1") { version { strictly '1.3.1' } } implementation("androidx.lifecycle:lifecycle-process:2.4.0") implementation("com.moengage:moe-android-sdk:12.5.05") debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3', module:'okhttp' } debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' } implementation project(':react-native-version-check') implementation project(':@react-native-voice_voice') if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'appname' include ':@react-native-voice_voice' project(':@react-native-voice_voice').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-voice/voice/android') include ':react-native-onesignal' project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android') // include ':react-native-track-player' // project(':react-native-track-player').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-track-player/android') apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') // react-native-version-check Gradle Plugin include ':react-native-version-check' project(':react-native-version-check').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-check/android') include ':react-native-moengage' project(':react-native-moengage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-moengage/android') ``` #### `MainApplication.java`: ```java package com.appname.android.app; // import com.facebook.react.bridge.JSIModulePackage; // import com.swmansion.reanimated.ReanimatedJSIModulePackage; import io.xogus.reactnative.versioncheck.RNVersionCheckPackage; import android.database.CursorWindow; import java.lang.reflect.Field; import com.microsoft.codepush.react.CodePush; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; import com.moengage.core.MoEngage; import com.moengage.core.config.FcmConfig; import com.moengage.core.config.NotificationConfig; import com.moengage.react.MoEInitializer; import com.moengage.react.MoEReactPackage; import com.moengage.core.DataCenter; import com.moengage.core.config.LogConfig; import com.moengage.core.LogLevel; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected String getJSBundleFile() { return CodePush.getJSBundleFile(); } // @Override protected JSIModulePackage getJSIModulePackage() { return new ReanimatedJSIModulePackage(); } @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 public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); try { Field field = CursorWindow.class.getDeclaredField("sCursorWindowSize"); field.setAccessible(true); field.set(null, 100 * 1024 * 1024); // the 100MB is the new size // MoEngage moEngageE = new MoEngage.Builder(this, "GMVS2E3RMBVWMTBWM6MG872Z") // .configureLogs(new LogConfig(LogLevel.VERBOSE, true)) // .build(); MoEngage.Builder moEngage = new MoEngage.Builder(this, "GMVS2E3RMBVWMTBWM6MG872Z") .configureNotificationMetaData(new NotificationConfig(R.drawable.small_icon, R.drawable.large_icon)) .configureFcm(new FcmConfig(true)) .configureLogs(new LogConfig(LogLevel.VERBOSE, true)) .setDataCenter(DataCenter.DATA_CENTER_4); MoEInitializer.INSTANCE.initializeDefaultInstance(getApplicationContext(), moEngage); } catch (Exception e) { // if (DEBUG_MODE) { // e.printStackTrace(); // } } } /** * Loads Flipper in React Native templates. Call this in the onCreate method * with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* * We use reflection here to pick up the class that initializes Flipper, * since Flipper library is not available in release mode */ Class aClass = Class.forName("com.appname.android.app.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } } ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 13.3.1 CPU: (8) arm64 Apple M1 Memory: 113.25 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.16.0 - /opt/homebrew/opt/node@18/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.5.1 - /opt/homebrew/opt/node@18/bin/npm Watchman: 2023.05.22.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.1 - /Users/appName/.rvm/gems/ruby-2.7.6/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9971841 Xcode: 14.1/14B47b - /usr/bin/xcodebuild Languages: Java: 11.0.19 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: ^17.0.2 => 17.0.2 react-native: ^0.66.5 => 0.66.5 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found ``` - **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/analytics": "^15.0.0" "@react-native-firebase/app": "^15.0.0" "@react-native-firebase/crashlytics": "^15.0.0" "@react-native-firebase/in-app-messaging": "^15.0.0" "@react-native-firebase/messaging": "^15.0.0" "react-native": "^0.66.5" ``` - **Are you using `TypeScript`?** - `No


nl-danish commented 6 months ago

(UPDATE)

I noticed that in my Podfile, I had this line

target 'ImageNotification' do
  pod 'Firebase/Messaging', '~> 8.15.0' # Version should match the podfile.lock version Refer https://rnfirebase.io/messaging/ios-notification-images
end

So, i changed it to

target 'ImageNotification' do
  pod 'Firebase/Messaging', '~> 9.1.0' # Version should match the podfile.lock version Refer https://rnfirebase.io/messaging/ios-notification-images
end

Now the error of Firebase/Messaging is gone, but a new error is here,

[!] Unable to integrate the following embedded targets with their respective host targets (a host target is a "parent" target which embeds a "child" target like a framework or extension):

- NewsLaundry (true) and ImageNotification (false) do not both set use_frameworks!.
- NewsLaundry (true) and OneSignalNotificationServiceExtension (false) do not both set use_frameworks!.
nl-danish commented 6 months ago

(UPDATE 2)

I added use_frameworks!, after both ImageNotification and OneSignalNotificationServiceExtension, and it got resolved.