通过添加以下行来响应本地应用程序崩溃:Apply插件:'com.google.gms.google-services'

时间:2019-04-28 07:04:55

标签: android firebase react-native

在我的react本机应用程序中,我添加了firebase,因此我的root gradle和app gradle是:

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

...

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

应用正常运行。

我被毁了,请帮助我:)

0 个答案:

没有答案