1

I want to use firebase phone authentication, so I am trying to add react-native-firebase like... I add this to android/app/build.gradle

    dependencies {
    compile project(':react-native-config')
    compile(project(':react-native-firebase')) {
        transitive = false
    }

    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules

    // Firebase dependencies
    compile "com.google.android.gms:play-services-base:11.6.0"
    compile "com.google.firebase:firebase-core:11.6.0"
    compile "com.google.firebase:firebase-auth:11.6.0"
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}
apply plugin: 'com.google.gms.google-services'

and in project level build.gradle

 buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:3.1.1'
        classpath 'com.android.tools.build:gradle:2.2.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com'
        }

    }
}

I did react-native link as well but it's not loading..

can you please help in what exactly I am missing here...

enter image description here

Arun Tyagi
  • 2,206
  • 5
  • 24
  • 37

2 Answers2

1

Its late reply but helpful for others. you need to add RNFirebasePackage package in MainApplication.java file inside getPackages.

 public class MainApplication extends Application implements ReactApplication {



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

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

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}

Helpful Answer

Naeem Ibrahim
  • 3,375
  • 1
  • 21
  • 21
0

My Issue was I was trying to use React-native-firebase with EXPO, which is not possible.

Arun Tyagi
  • 2,206
  • 5
  • 24
  • 37