1

Hi I am using Below package in react-native app https://www.npmjs.com/package/firebase

My app uses firebase and firestore both I have no issue in ios app But in android app (firebase/firestore is not getting connected to internet)

Any idea ?

@firebase/firestore: Firestore (7.23.0): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds. This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

Android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 16
        compileSdkVersion = 29
        targetSdkVersion = 29
    }
    repositories {
        google()
        jcenter()
        google()  // Google's Maven repository
    }
    dependencies {
        classpath('com.android.tools.build:gradle:4.1.0')
        classpath 'com.google.gms:google-services:4.3.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()  // Google's Maven repository
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}
Jatin Garg
  • 306
  • 1
  • 2
  • 16

2 Answers2

0

From the chat, I notice that you have not created Android app in Firebase console. Please create the app and generate the credentials and paste it in /android/app/. For more info on How to configure React Native app for Android and iOS, visit here.

fatalcoder524
  • 1,428
  • 1
  • 7
  • 16
-1

In Android, we need request Internet permission for network action, maybe you missing it, let check your manifest.

dinhlam
  • 708
  • 3
  • 14