I'm developing an app using React-Native and I'm trying to connect it to my Firebase database. When I try to run my code (i.e., react-native run-android), I get the following:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find com.google.firebase:firebase-database: 15.0.0.
I've looked at the solutions proposed in Could not find com.google.firebase:firebase-database:9.2.0 and react native Could not find com.google.firebase, but neither have worked for me so far...
Here is my top level build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:4.0.0'
// 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" }
maven { url "https://jitpack.io" }
}
}
Here is part of my app level build.gradle file:
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile "com.google.firebase:firebase-core:15.0.2"
compile "com.google.firebase:firebase-database: 15.0.0"
compile "com.google.android.gms:play-services-base:15.0.0"
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
How can I fix this issue? Thanks.