Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 30349

Using Firestore in React native application

$
0
0

I'm trying to hook up an android application written in react-native with firebase firestore. but whenever i use a firestore function like,

    this.refs = firebase.firestore().collection('Users');
    this.refs.add({
        name :'athul',
        email :'athulrajts@gmail.com',
        dob :'03/01/1996'
    }).catch(err => { 
        console.log(err);
    });

It throws an exception

Could not invoke RNFirebaseFirestore.documentSet

null

Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;

Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.testproject-XmYvg1GYDdffiHWjlrlSoQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.testproject-XmYvg1GYDdffiHWjlrlSoQ ==/lib/arm64, /data/app/com.testproject-XmYvg1GYDdffiHWjlrlSoQ ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64

android/app/build.gradle

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'com.android.support:multidex:1.0.3'
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-auth:19.3.0'
    implementation "com.google.firebase:firebase-firestore:11.8.0"

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

//
//
    defaultConfig {
        applicationId "com.testproject"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

MainApplication.java

        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          // packages.add(new MyReactNativePackage());
          packages.add(new RNFirebaseAuthPackage());
          packages.add(new RNFirebaseFirestorePackage());
          return packages;
        }

I've followed the react-native-firebase documentation to setup firebase. I've been searching for solution for a whole day now and i'm not able to find anything useful, please point me to the right direction.


Viewing all articles
Browse latest Browse all 30349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>