React-native-firebase: v6 Android gradle sync fails

Created on 22 Jul 2019  路  17Comments  路  Source: invertase/react-native-firebase

Hey,

I have a completely fresh project created with npx @react-native-community/cli@next init --template=@react-native-firebase/template and iOS project is running all fine. On Android gradle sync fails and I'm not able to run with the below error. Upgraded gradle to 5.2.1 to see if it will help but didn't. I'm running react-native-cli: 2.0.1 and react-native: 0.59.8. I've tried upgrading react-native to 0.60 via react-native upgrade but that fails as well. Any help will be greatly appreciated.

react-native run-android log:

info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...

FAILURE: Build failed with an exception.

* Where:
Script '/Users/[user-name]/Developer/[project-name]/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 190

* What went wrong:
A problem occurred evaluating settings '[project-name]'.
> Unable to determine the current character, it is not a string, number, array, or object

  The current character read is 'i' with an int value of 105
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  info Run "react-native --help" to see a list of all available commands.
  ^

package.json:

{
  "name": [project-name],
  "version": "0.0.26",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "run:android": "react-native run-android",
    "run:ios": "react-native run-ios --simulator=\"iPhone X\"",
    "build:apk": "cd android && ./gradlew assembleRelease",
    "test": "jest",
    "prepare": "patch-package"
  },
  "dependencies": {
    "@react-native-firebase/app": "^0.0.26",
    "react": "16.8.1",
    "react-native": "0.59.8"
  },
  "devDependencies": {
    "@babel/core": "^7.3.3",
    "@babel/runtime": "^7.3.1",
    "@react-native-community/cli": "2.0.0-alpha.23",
    "@react-native-community/eslint-config": "^0.0.3",
    "babel-jest": "^24.1.0",
    "jest": "^24.1.0",
    "metro-react-native-babel-preset": "^0.51.1",
    "patch-package": "^6.1.0",
    "react-test-renderer": "16.8.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

build.gradle:

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

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        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")
        }

        jcenter()
    }
}

settings.gradle:

rootProject.name = [project-name]
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

Most helpful comment

My error is similar to yours but not the same.
Try deleting app\build\intermediates\signing_config\debug\out\signing-config.json
this worked for me.
(also ran as admin)

All 17 comments

Getting Same Issue. Any help.

I am also getting same issue. Please help !

same here :(

My error is similar to yours but not the same.
Try deleting app\build\intermediates\signing_config\debug\out\signing-config.json
this worked for me.
(also ran as admin)

My error is similar to yours but not the same.
Try deleting app\build\intermediates\signing_config\debug\out\signing-config.json
this worked for me.
(also ran as admin)

Lifesaver... this worked for me. Thanks!

If deleting that file saves you, it's the same as doing cd android && ./gradlew clean

To me this seems like an odd set of dependencies. I'd go with a regular init (not off cli@next) to get RN60, then use the RNFB6 template (which is in the command line you are init'ing already), and I'd use the AndroidX dependencies from firebase SDK (you don't mention those, but it's play services 17+ and all the newest android firebase SDK versions). Basically, full-current. Otherwise you'll figure out how to get this working but it will be obsolete knowledge immediately, with no good upgrade path

@mikehardy To your first point: Clearly not as I have on several occasions done gradlew clean to no affect.

cd android && ./gradlew clean also didn't work for me, but removing the file manually did

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

@mikehardy
what do you mean by regular init?
Do you mean that we should not use this dependency at all.
also, If I will use rnFirebase version 6. I won't face this issue?

  • regular init: react-native init rn60rnfbexample or similar. No extra arguments.
  • I don't know what "this dependency" you are referring to
  • this issue is about v6 android gradle sync failing. So "if I will use rnFirebase version 6. I won't face this issue?" makes no sense

I'm still on v5 so I'm not sure about v6 but this is their recommendation: https://invertase.io/oss/react-native-firebase/quick-start/new-project

and my recommendation is always follow the docs in general...

I have the same error, but app\build\intermediates\signing_config\debug\out\signing-config.json does NOT exist in my directory. Any updates on what should be done if this is the case?

My error is similar to yours but not the same.
Try deleting app\build\intermediates\signing_config\debug\out\signing-config.json
this worked for me.
(also ran as admin)

Thx mate :), this solved my problem

Given that this error is coming from @react-native-community/cli-platform-android/native_modules.gradle' line: 190 (the auto-linking script in the CLI) I'm going to close this issue - but feel free to continue the conversation 馃憤

I have the same error, but app\build\intermediates\signing_config\debug\out\signing-config.json does NOT exist in my directory. Any updates on what should be done if this is the case?

Same Here. Tried cd android && ./gradlew clean and didn't work for me. I tried run in another project (Hello World initial) and run without error

In my case bash was not installed in the Docker (build) container.

I am facing the same issue. I tried to remove react-native-firebase package. and I have been getting this issue since. I don't get it if I add firebase again but get a different error for firebase

Was this page helpful?
0 / 5 - 0 ratings