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

RNFirebase core module was not found natively on android, Firebase 16.7.0 #7064

Closed himmat-pratap-netsmartz closed 1 year ago

himmat-pratap-netsmartz commented 1 year ago

Issue

I have updated my prohect from v5 to latest firebase version , Now I am having issue with a React Native project for android platform. We searched about it and it is only for older version of firebase module for having manual installation. For this project its automatic installation but we are getting this issue for apk although working fine in simulator while development

"react-native": "^0.67.5", "@react-native-firebase/app": "16.7.0", "@react-native-firebase/messaging": "16.7.0",

Describe your issue here ![Uploading Error.jpeg…]()


Project Files

Android: android/build.gradle // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript { ext { buildToolsVersion = '33.0.2' minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 ndkVersion = "21.4.7075529" googlePlayServicesAuthVersion = "16.0.1" kotlinVersion = "1.7.0" versionCode = "6" versionName = "1.0.7" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle:7.1.3") classpath 'com.google.gms:google-services:4.3.15' classpath 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } }

allprojects {

repositories {

    google()
    jcenter()
    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")
    }
    mavenCentral {
        // We don't want to fetch react-native from Maven Central as there are
        // older versions over there.
        content {
            excludeGroup "com.facebook.react"
        }
    }
    maven { url 'https://www.jitpack.io' }
    exclusiveContent {
        // We get React Native's Android binaries exclusively through npm,
        // from a local Maven repo inside node_modules/react-native/.
        // (The use of exclusiveContent prevents looking elsewhere like Maven Central
        // and potentially getting a wrong version.)
        filter {
            includeGroup "com.facebook.react"
        }
        forRepository {
            maven {
                // NOTE: if you are in a monorepo, you may have "$rootDir/../../../node_modules/react-native/android"
                url "$rootDir/../node_modules/react-native/android"
            }
        }
    }
}

} `

android/app/build.gradle apply plugin: "com.android.application" // apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" apply plugin: 'com.google.gms.google-services'

/**

project.ext.react = [ enableHermes: false, // clean and rebuild if changing ]

apply from: "../../node_modules/react-native/react.gradle"

/**

/**

/**

/**

dependencies {

implementation "com.google.android.gms:play-services-base:16.1.0"
// firebase core messaging
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"  // From node_modules
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation platform('com.google.firebase:firebase-bom:31.5.0')

// 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'
// }

if (enableHermes) {
    def hermesPath = "../../node_modules/hermes-engine/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
    implementation jscFlavor
}

}

// Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.implementation into 'libs' }

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.abcd">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:theme="@style/AppTheme"
  android:usesCleartextTraffic="true">
    <activity
        android:name=".SplashActivity"
        android:theme="@style/SplashScreenTheme"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTop"
        android:windowSoftInputMode="adjustPan"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustPan"
    android:exported="true">
  <!--
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
  -->
  </activity>

    <meta-data
      android:name="com.google.firebase.messaging.default_notification_icon"
      android:resource="@mipmap/ic_launcher_foreground" />
    <meta-data
      android:name="com.google.firebase.messaging.default_notification_channel_id"
      android:value="Default"
      tools:replace="android:value" />
</application>

.

Javascript

Click To Expand

#### `package.json`: { "name": "abcd", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "androiddev": "react-native run-android --variant=devDebug --appIdSuffix=dev", "androiddevprod": "react-native run-android --variant=prodDebug --appIdSuffix=prod", "ios": "react-native run-ios --simulator \"iPhone 11\"", "start": "react-native start", "test": "jest", "lint": "eslint .", "postinstall": "make post-install" }, "dependencies": { "@invertase/react-native-apple-authentication": "2.1.0", "@react-native-async-storage/async-storage": "^1.15.8", "@react-native-community/netinfo": "^7.0.0", "@react-native-community/push-notification-ios": "^1.11.0", "@react-native-firebase/app": "16.7.0", "@react-native-firebase/messaging": "16.7.0", "@react-native-google-signin/google-signin": "8.2.1", "@react-native-masked-view/masked-view": "^0.2.6", "@react-native-picker/picker": "1.14.0", "@react-navigation/bottom-tabs": "^5.11.8", "@react-navigation/native": "^5.9.8", "@react-navigation/stack": "^5.14.9", "@ubaids/react-native-material-textfield": "https://github.com/ubaidjs/react-native-material-textfield", "axios": "^0.21.1", "babel-plugin-transform-remove-console": "^6.9.4", "html-entities": "^2.3.3", "jwt-decode": "^3.1.2", "light-event-bus": "^1.0.1", "moment": "^2.29.1", "react": "17.0.2", "react-content-loader": "^6.0.3", "react-native": "^0.67.5", "react-native-config": "1.5.0", "react-native-deck-swiper": "https://github.com/webraptor/react-native-deck-swiper", "react-native-device-info": "8.1.3", "react-native-fast-image": "^8.3.4", "react-native-flash-message": "^0.1.23", "react-native-gesture-handler": "2.5.0", "react-native-globalspinner": "^2.0.2", "react-native-image-picker": "3.6.0", "react-native-keyboard-manager": "^6.5.11-0", "react-native-modal": "^13.0.0", "react-native-orientation-locker": "^1.3.0", "react-native-phone-number-input": "^2.1.0", "react-native-popup-menu": "^0.15.10", "react-native-push-notification": "^8.1.1", "react-native-reachability-popup": "^1.0.4", "react-native-reanimated": "2.4.0", "react-native-safe-area-context": "^3.2.0", "react-native-screens": "^3.2.0", "react-native-splash-screen": "^3.2.0", "react-native-svg": "^12.1.1", "react-native-swipe-list-view": "^3.2.7", "react-native-video": "^5.2.1", "react-native-video-controls": "^2.8.1", "react-native-webview": "^11.13.0", "react-redux": "^7.2.3", "redux-logger": "^3.0.6", "redux-persist": "^6.0.0", "redux-saga": "^1.1.3", "redux-storage": "^4.1.2", "redux-storage-decorator-filter": "^1.1.8", "version": "^0.1.2" }, "devDependencies": { "@babel/core": "^7.13.13", "@babel/runtime": "^7.13.10", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", "eslint": "^7.23.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.66.2", "react-test-renderer": "17.0.2" }, "jest": { "preset": "react-native" } } ```json # N/A ``` #### `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 # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```


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:** ``` OUTPUT GOES HERE ``` - **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. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N` & `VERSION`


himmat-pratap-netsmartz commented 1 year ago

found the issue, it was a older android bundle placed in android folder, which was creating the issue