android – FCM通知:无法初始化

前端之家收集整理的这篇文章主要介绍了android – FCM通知:无法初始化前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我是firebase的新手,我想实施Firebase云消息传递(FCM)我正面临着开始使用它的问题. firebase没有初始化.谢谢你的帮助.

的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'

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

build.gradle(app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.example.sai_praneeth7777.hasportal"
        minSdkVersion 21
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs',include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:24.0.0'

    compile 'com.google.firebase:firebase-crash:9.2.0'
    compile 'com.google.firebase:firebase-messaging:9.2.0'

    compile 'com.mcxiaoke.volley:library:1.0.18'
    compile 'com.google.code.gson:gson:2.4'

    compile 'com.android.support:cardview-v7:24.0.0'
}

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

这是logcat

07-06 19:17:00.397 18894-18894/ D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
07-06 19:17:00.482 18894-18894/ W/GooglePlayServicesUtil: Google Play services out of date.  Requires 9256000 but found 9080280
07-06 19:17:00.483 18894-18894/ I/DynamiteModule: Considering local module com.google.android.gms.flags:1 and remote module com.google.android.gms.flags:0
07-06 19:17:00.487 18894-18894/ I/DynamiteModule: Selected local version of com.google.android.gms.flags
07-06 19:17:00.501 18894-18894/ W/ResourcesManager: Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
07-06 19:17:00.501 18894-18894/ W/ResourcesManager: Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
07-06 19:17:00.510 18894-18894/ W/DynamiteModule: Local module descriptor class for com.google.android.gms.crash not found.
07-06 19:17:00.517 18894-18894/ W/GooglePlayServicesUtil: Google Play services out of date.  Requires 9256000 but found 9080280
07-06 19:17:00.517 18894-18894/ I/DynamiteModule: Considering local module com.google.android.gms.crash:0 and remote module com.google.android.gms.crash:0
07-06 19:17:00.527 18894-18894/ E/FirebaseCrash: Failed to initialize crash reporting
com.google.firebase.crash.internal.zzg$zza: com.google.android.gms.internal.zzsj$zza: No acceptable module found. Local version is 0 and remote version is 0.
at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source)
at com.google.firebase.crash.FirebaseCrash.Failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_required,resolution=null,message=null}
07-06 19:17:00.983 18894-18907/ W/art: Suspending all threads took: 14.572ms
[ 07-06 19:17:01.050 18894:18927 D/         ]
HostConnection::get() New Host Connection established 0x7fe26d476180,tid 18927
07-06 19:17:01.064 18894-18927/ I/OpenGLRenderer: Initialized EGL,version 1.4
07-06 19:17:01.101 18894-18927/ D/OpenGLRenderer: Enabling debug mode 0
07-06 19:17:10.845 18894-18925/ I/FA: Tag Manager is not found and thus will not be used
07-06 19:17:10.847 18894-18925/ W/GooglePlayServicesUtil: Google Play services out of date.  Requires 9256000 but found 9080280
07-06 19:17:10.847 18894-18894/ W/FA: Service connection Failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_required,message=null}
07-06 19:18:19.553 18894-19743/ W/FA: Tasks have been queued for a long time
07-06 19:18:19.930 18894-18902/ W/art: Suspending all threads took: 215.213ms
07-06 19:18:20.050 18894-18907/ I/art: Background sticky concurrent mark sweep GC freed 910(82KB) AllocSpace objects,3(48KB) LOS objects,11% free,1679KB/1904KB,paused 80.391ms total 305.959ms
07-06 19:18:20.059 18894-18907/ W/art: Suspending all threads took: 6.418ms

希望这些信息有助于解决问题

最佳答案
在日志显示中,您获得FirebaseApp初始化成功,这意味着您的推送通知已成功注册.

如果您从控制台发送消息而您没有收到任何信息,请考虑以下事项:

>使用真实设备而不是模拟器检查推送通知.
>确保您的设备可以访问互联网.

猜你在找的Android相关文章