hos*_*abi 5 android firebase react-native
在我的 React Native 应用程序中,我添加了 firebase ,所以我的根 gradle 和应用程序 gradle 是:
根构建.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()
}
}
...
Run Code Online (Sandbox Code Playgroud)
应用程序构建.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'
Run Code Online (Sandbox Code Playgroud)
当我运行项目时,应用程序崩溃了;但是当我评论这一行时:
// apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
应用程序正确运行。
我被毁了,请帮助我:)
小智 0
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"
| 归档时间: |
|
| 查看次数: |
1471 次 |
| 最近记录: |