React-native-firebase: Attempted to use firebase module that's not installed on your android project- firebase.storage()

Created on 13 Apr 2018  路  20Comments  路  Source: invertase/react-native-firebase

I have an error why I try call **firebase.storage()** anywhere in the app. What is more firebase.auth(), firebase.database()working fine.

I did gradlew clean, reinstalled all from package.json. Nothing help.

This bellow should be fine because auth and database work fine, but I paste it.

My build.gradle file

dependencies {
    compile project(':react-native-image-crop-picker')
    compile(project(':react-native-firebase')) {
        transitive = false
    }
    compile project(':react-native-fetch-blob')
    compile project(':react-native-fbsdk')
    implementation project(':react-native-image-crop-picker')
    implementation project(':react-native-fbsdk')
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    implementation project(':react-native-firebase')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.1.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation(project(':react-native-firebase')) {
        transitive = false
    }

    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }

    implementation "com.google.android.gms:play-services-base:12.0.1"
    implementation "com.google.firebase:firebase-core:12.0.1"
    implementation "com.google.firebase:firebase-auth:12.0.1"
    implementation "com.google.firebase:firebase-database:12.0.1"

}

Environment

ANDROID

  1. Application Target Platform:
    MacOS android studio emulator
  1. Development Operating System:
    Nexus 6 API 27

  2. Build Tools:

  1. React Native version:
    "react-native": "0.54.1",

  2. RNFirebase Version:
    "react-native-firebase": "4.0.0",

Build Error Android User Issue Storage

Most helpful comment

i have same issue

I have found the solution,
if u r using react native version 0.60 then u have to add package in the MainApplication.java in following way.
packages.add( new RNFirebaseAuthPackage());

After adding this package if ur app is still not working then uninstall ur app from emulator and reinstall .....Then everything will work

All 20 comments

Please follow the installation instructions: https://rnfirebase.io/docs/v4.0.x/storage/android

You need to include the firebase-storage dependency in your build.gradle.

I am having similar issue with messaging, I am not using pods with linked the framework manually

@chrisbianca I don't know why people are down voting you. I was stuck by hours trying to get out of this error and the solution was install the firebase analytics part.

Thank you man!

I need you guys to help me solve this error please. I got stuck with this error in couple of week. can you guys help me please. my error is Error: you attempted to use a firebase module that's not installed on your android project by calling firebase.auth(). Is the above error same with this error?
Thank you.
Screenshot_1553074894

I need you guys to help me solve this error please. I got stuck with this error in couple of week. can you guys help me please. my error is Error: you attempted to use a firebase module that's not installed on your android project by calling firebase.auth(). Is the above error same with this error?
Thank you.

stuck her too
i triple check the installation doc

I saw this once when I did not follow the installation doc.
In your android application java did you actually include/initialize things?

https://github.com/invertase/react-native-firebase-docs/blob/v5.x.x/docs/auth/android.md#install-the-rnfirebase-authentication-package

I solved the issue using:

new RNFirebaseNotificationsPackage()

into my MainApplication.java

app/build.gradle
implementation "com.google.firebase:firebase-storage:15.0.2"

MainApplication.java

import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage; // <-- Add this line

public class MainApplication extends Application implements ReactApplication {
// ...

@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
      new RNFirebasePackage(),
      new RNFirebaseAuthPackage() // <-- Add this line
  );
}

};
// ...
}

Screenshot_1563990196

Capture 2
Capture 1

I am stuck on this error and unable to solve it for 2 weeks, Please help me. I even installed react-native-firebase-auth

Im facing the same issue as @Jahanzai6 .
Tried everything given on this thread.
Included the dependencies in build.gradle as well as the main.application.java.
But still showing the same error.
Can someone please help here

haven't find the solution yet

i have same issue

i have same issue

I have found the solution,
if u r using react native version 0.60 then u have to add package in the MainApplication.java in following way.
packages.add( new RNFirebaseAuthPackage());

After adding this package if ur app is still not working then uninstall ur app from emulator and reinstall .....Then everything will work

Im facing the same issue as @Jahanzai6 .
Tried everything given on this thread.
Included the dependencies in build.gradle as well as the main.application.java.
But still showing the same error.
Can someone please help here

I Found the solution, read my above comment.

i have same issue

I have found the solution,
if u r using react native version 0.60 then u have to add package in the MainApplication.java in following way.
packages.add( new RNFirebaseAuthPackage());

After adding this package if ur app is still not working then uninstall ur app from emulator and reinstall .....Then everything will work

thanks it's very helpful for me @Jahanzai6

For react-native-firebase modules on RN59 follow the pattern here https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-rn59.sh

You can see what you have to do for each one in that script. You also have to add the pod in the Podfile for iOS of course

i have same issue

I have found the solution,
if u r using react native version 0.60 then u have to add package in the MainApplication.java in following way.
packages.add( new RNFirebaseAuthPackage());

After adding this package if ur app is still not working then uninstall ur app from emulator and reinstall .....Then everything will work

this is the right solution for whoever is using react-native 0.60+

i have same issue

I have found the solution,
if u r using react native version 0.60 then u have to add package in the MainApplication.java in following way.
packages.add( new RNFirebaseAuthPackage());

After adding this package if ur app is still not working then uninstall ur app from emulator and reinstall .....Then everything will work

After adding the above code, I got error as

 packages.add( new RNFirebaseAuthPackage()),

            ^
  symbol:   variable packages
  location: class MainApplication

@creativemind1 - an infinite number of ways to go wrong, maybe try generating a throwaway example by cloning this repo and running this script (assuming you are trying react-native-firebase v5 + react-native 0.60+?): https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

I'm using "react-native-firebase": "~5.6.0", "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",. I'm using Expokit and in iOS all is fine but just have trouble with android. I wanted to clone your repo but again I thought as I'm using Expokit there might be some glitch somewhere..

Was this page helpful?
0 / 5 - 0 ratings