firebase api初始化失败



我已经在我的Android项目中集成了FCM数据库。我将其用于聊天应用程序。现在,我需要使用Firebase实现云消息(推送通知(。实现FCM后,我遇到了一个错误 -

firebase API初始化失败。java.lang.reflect.invocationTargetException

我正在发送Gradle脚本,请查看。

模块:app

apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.example.swatin.groupchatapplication"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
             }
           }
 }
 repositories {
 mavenCentral()
  maven { url 'https://maven.google.com' }
 }
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':libbambuser-0.9.12')
compile 'com.basgeekball:awesome-validation:1.3'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.razorpay:checkout:1.4.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui:2.0.1'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.bumptech.glide:glide:4.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.volley:volley:1.1.0-rc1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.14.2'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
} 
apply plugin: 'com.google.gms.google-services'

build.gradle(project:projectName(

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
    jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

要解决此问题,您需要添加以下代码行:

apply plugin: 'com.google.gms.google-services'

作为build.gradle (Project: ProjectName)文件中的最后一行。

,如果您还在使用身份验证,请使用此代码行:

compile 'com.google.android.gms:play-services-auth:10.0.1'

我也强烈建议您使用最新版本来适合您的firebase依赖性。最新版本现在是: 11.8.0

Google Play服务的最后一个版本是:

classpath 'com.google.gms:google-services:3.2.0'

相关内容

  • 没有找到相关文章

最新更新