gpt4 book ai didi

android - 通过添加此行 : apply plugin: 'com.google.gms.google-services' 来 react native 应用程序崩溃

转载 作者:行者123 更新时间:2023-12-04 23:51:06 27 4
gpt4 key购买 nike

在我的 react native 应用程序中,我添加了 firebase ,所以我的根 gradle 和 app gradle 是:

根 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()
}
}

...

应用程序构建.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'

当我运行项目时,应用程序崩溃了;但是当我评论这一行时:
//    apply plugin: 'com.google.gms.google-services'

应用程序正常运行。

我被毁了,请帮助我:)

最佳答案

我遇到了同样的问题...崩溃的原因是没有将 android 应用程序添加到我的 firebase 项目中(需要 google-services.json)。检查此Error "File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it"

关于android - 通过添加此行 : apply plugin: 'com.google.gms.google-services' 来 react native 应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55887865/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com