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

Attempted to use firebase module that's not installed on your android project- firebase.storage() #977

Closed phuzarski closed 6 years ago

phuzarski commented 6 years ago

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

  2. Development Operating System: Nexus 6 API 27

  3. Build Tools:

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

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

chrisbianca commented 6 years ago

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.

noumantahir commented 6 years ago

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

phsantiago commented 5 years ago

@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!

meyonn commented 5 years ago

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

alainib commented 5 years ago

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

mikehardy commented 5 years ago

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

fgagneten commented 5 years ago

I solved the issue using:

new RNFirebaseNotificationsPackage()

into my MainApplication.java

Anuskhan commented 5 years ago

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
  );
}

}; // ... }

Jahanzai6 commented 5 years ago

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

BilalS10 commented 5 years ago

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

Jahanzai6 commented 5 years ago

haven't find the solution yet

optimistic-coder commented 5 years ago

i have same issue

Jahanzai6 commented 5 years ago

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

Jahanzai6 commented 5 years ago

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.

optimistic-coder commented 5 years ago

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

mikehardy commented 5 years ago

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

bimix commented 5 years ago

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+

creativemind1 commented 4 years ago

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
mikehardy commented 4 years ago

@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

creativemind1 commented 4 years ago

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..

SofticKabir commented 2 years ago

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

I tried this but I am still getting the initial error...

mikehardy commented 2 years ago

There is no reason to add anything to anywhere anymore on android in react-native 0.60+ with auto-linking. Disregard any advice to manually link.

Please see this script (read it, read the comments) along with the rnfirebase.io install instructions for step by step walk through on how to integrate this properly from scratch: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

vikasswebdev commented 2 years ago

i found a sam issue solution: uninstall you app in emulator and rebuild.

impaaras commented 2 years ago

@Jahanzai6

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 @Jahanzai6 I working using Expo go app so what i should do, as I am not on Emulator. please help me to solve this error

codexjoshy commented 2 years ago

@Jahanzai6 i'm having same issue with expo, found any solution to it yet ?

Jahanzai6 commented 2 years ago

Try to run command npm i

then delete the app and reinstall it .

On Sun, Aug 7, 2022 at 9:20 PM codexjoshy @.***> wrote:

@Jahanzai6 https://github.com/Jahanzai6 i'm having same issue with expo, found any solution to it yet ?

— Reply to this email directly, view it on GitHub https://github.com/invertase/react-native-firebase/issues/977#issuecomment-1207440730, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKZONIDNRF52VZYBEKC7EATVX7O4XANCNFSM4E2PG7EA . You are receiving this because you were mentioned.Message ID: @.***>

Jahanzai6 commented 2 years ago

add package in the MainApplication.java in following way. packages.add( new RNFirebaseAuthPackage());

On Sun, Aug 7, 2022 at 9:22 PM Jahanzaib Liaqat @.***> wrote:

Try to run command npm i

then delete the app and reinstall it .

On Sun, Aug 7, 2022 at 9:20 PM codexjoshy @.***> wrote:

@Jahanzai6 https://github.com/Jahanzai6 i'm having same issue with expo, found any solution to it yet ?

— Reply to this email directly, view it on GitHub https://github.com/invertase/react-native-firebase/issues/977#issuecomment-1207440730, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKZONIDNRF52VZYBEKC7EATVX7O4XANCNFSM4E2PG7EA . You are receiving this because you were mentioned.Message ID: @.***>

Jahanzaib320 commented 2 years ago

@impaaras @codexjoshy I would suggest you not to use expo. Expo comes with limitations.

Try to add package in the MainApplication.java in following way. packages.add( new RNFirebaseAuthPackage());

2) npm I

3) Uninstall the app and reinstall it

WilliamSilveiraF commented 2 years ago

I got this error because i had "@react-native-async-storage/async-storage" and "@react-native-community/async-storage"(deprecated) installed at my packages

mikehardy commented 1 year ago

@ceconcarlsen that defeats auto-linking in react-native and is a sub-standard solution. No one should follow that suggestion, and you should determine why auto-linking is not working for you so your project is fixed in general

omivrex commented 1 year ago

@codexjoshy I am using expo-dev-client I fixed this by uninstalling the dev-client app and re-building it.

gosunman commented 1 year ago

yeah instead of expo start --dev-client

run expo run:android and expo run:ios each then it will rebuild and run correctly.