react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

RNFirebase core module was not found natively on Android

Open littlehome-eugene opened this issue 8 years ago • 8 comments

Issue

RNFirebase core module was not found natively on Android

https://github.com/invertase/react-native-firebase#supported-versions---react-native--firebase table shows I've to use 11.6.2 for react-native 0.51

although node_modules/react-native-firebase/android/build.gradle has buildscript { ext.firebaseVersion = '11.4.2' }

Is that a problem?

  • android/build.gradle

 buildscript {
     repositories {

  dependencies {
    classpath 'com.google.gms:google-services:3.1.2'
 }
}


project.ext.react = [
     entryFile: "index.js"
 ]

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



allprojects {
  repositories {
  
         maven { url "$rootDir/../node_modules/react-native/android" }

         maven {
             url 'https://maven.google.com'
         }
  }
}

  • android/app/build.gradle

 dependencies {
     compile(project(':react-native-firebase')) {
         transitive = false
     }
     compile "com.google.android.gms:play-services-base:11.6.2"
     compile "com.google.firebase:firebase-core:11.6.2"
     compile "com.google.firebase:firebase-analytics:11.6.2"


    compile "com.facebook.react:react-native:+"  // From node_modules
}

 apply plugin: 'com.google.gms.google-services'

  • main application

   private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
       @Override
       public boolean getUseDeveloperSupport() {
         return BuildConfig.DEBUG;
       }

       @Override
       protected List<ReactPackage> getPackages() {
         return Arrays.<ReactPackage>asList(
           new MainReactPackage(),
           new RNFirebasePackage(),
           new AutoHeightWebViewPackage(),
           new RNFirebaseAnalyticsPackage()
                                            );
       }

       @Override
       protected String getJSMainModuleName() {
         return "index";
       }
     };

  • settings.grade

include ':react-native-firebase'
 project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')


  • gradle.properties

 ANDROID_BUILD_TARGET_SDK_VERSION=23
 ANDROID_BUILD_SDK_VERSION=23

 ANDROID_BUILD_TOOLS_VERSION=23.0.1

 ANDROID_BUILD_MIN_SDK_VERSION=16


  • package.json
     "react": "^16.0.0",
     "react-native": "^0.51.0",
    "react-native-firebase": "^3.2.0",

Environment

  1. Application Target Platform: android
  1. Development Operating System: macOS Sierra
  1. Build Tools:
  1. React Native version: 0.51
  1. RNFirebase Version: 3.2
  1. Firebase Module: core, analytics

littlehome-eugene avatar Jan 05 '18 03:01 littlehome-eugene

I found

   @Override
   protected List<ReactPackage> getPackages() {
     return Arrays.<ReactPackage>asList(
       new MainReactPackage(),
       new RNFirebasePackage(),
       new AutoHeightWebViewPackage(),
       new RNFirebaseAnalyticsPackage()
                                        );
   }

code inside the function never gets executed .. is this normal?

littlehome-eugene avatar Jan 05 '18 09:01 littlehome-eugene

@littlehome-eugene, have you solved this issue? How? I have the same problem with my releasebuld, but not with dev.

RN 0.51, Expo SDK 24.0.0, RNFirebase 3.2.1, Firebase Android SDK 11.8.0

priezz avatar Jan 11 '18 13:01 priezz

Outside the MainApplication Class, there is another method as 'getPackages()'. You should add the additional packages there if you require them.

It solved the Issue for me. I hope this helps.

 protected List<ReactPackage> getPackages() {
        // Add additional packages you require here
        // No need to add RnnPackage and MainReactPackage
        return Arrays.<ReactPackage>asList(
            // eg. new VectorIconsPackage()
                new RNFirebasePackage(),
                new RNFirebaseDatabasePackage(),
                new RNFirebaseAdMobPackage(),
                new RNFirebaseAuthPackage()
        );
    }

weerakkodylr avatar Jan 30 '18 11:01 weerakkodylr

I have this issue as well, how did you solve it?

dmacmillan avatar Apr 25 '18 05:04 dmacmillan

I have same issue. RN + Expo. How to fix this !

steelx avatar May 27 '18 03:05 steelx

I also run to this issue guys, How do I fix this? any help would be much appreciated.. thanks @littlehome-eugene @dmacmillan @steelx

oliverboamah avatar Jul 31 '18 16:07 oliverboamah

@OliverTheCoder @steelx please refer https://github.com/invertase/react-native-firebase/issues/738#issuecomment-409482220

littlehome-eugene avatar Aug 01 '18 07:08 littlehome-eugene

Thanks for the quick feedback, I looked at the #738, however i'm running it on android not ios, I even created a new react-native project and followed the instructions for integrating react-native-firebase and also checked out their supported react-native versions but I still get the error: RNFirebase core module was not found natively on android even on the new clean project... what do I do now? @littlehome-eugene

oliverboamah avatar Aug 01 '18 17:08 oliverboamah