'react native app crash by adding this line: apply plugin: 'com.google.gms.google-services'
In my react native app i had added firebase , so my root gradle and app gradle is:
root build.gradle:
buildscript {
ext {
...
}
repositories {
google()
maven {
url 'https://maven.fabric.io/public'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
jcenter()
}
}
...
app build.gradle:
...
dependencies {
...
implementation 'com.android.support:design:${rootProject.ext.supportLibVersion}'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.google.firebase:firebase-core:16.0.1'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
When i run project , app crashed ; But when i comment this line:
// apply plugin: 'com.google.gms.google-services'
app run correctly.
I was ruined , please help me :)
Solution 1:[1]
I had the same issue... the reason of crash was not adding an android app to my firebase project (google-services.json is needed). Check this Error "File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tikhonova Elena |