React Native 通过添加以下行来响应本机应用程序崩溃:应用插件:“谷歌公司.通用汽车公司.谷歌服务”

lf3rwulv  于 2023-03-19  发布在  React
关注(0)|答案(2)|浏览(124)

在我的react原生应用中,我添加了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()
   }
}

...

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

应用程序正常运行。
我被毁了,请帮帮我:)

bvjxkvbb

bvjxkvbb1#

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

jslywgbw

jslywgbw2#

我的问题是“google-service.json”中的“软件包名称”与“project/app-module/build.gradle”中的“应用程序ID”不同

相关问题