RNFirebase не загружается на Android

Я хочу использовать аутентификацию телефона firebase, поэтому я пытаюсь добавить react-native-firebase, например... Я добавляю это в 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'

и на уровне проекта 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'
        }

    }
}

Я тоже реагировал на нативную ссылку, но она не загружается..

не могли бы вы помочь в том, что именно мне здесь не хватает...

введите здесь описание изображения


person Arun Tyagi    schedule 29.11.2017    source источник


Ответы (2)


Его поздний ответ, но полезный для других. вам нужно добавить пакет RNFirebasePackage в файл MainApplication.java внутри 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);
  }
}

Полезный ответ

person Naeem Ibrahim    schedule 05.01.2018

Моя проблема заключалась в том, что я пытался использовать React-native-firebase с EXPO, что невозможно.

person Arun Tyagi    schedule 26.03.2018