【问题标题】:The worked code for FCM notification is not working now?FCM 通知的工作代码现在不起作用?
【发布时间】:2019-07-04 15:13:59
【问题描述】:

我在一个使用 firebase 通知进程的 android 项目中工作,它一直运行到上周为止,但应用程序无法接收来自服务器的通知,并且我在该进程中遇到错误。

我无法理解里面发生了什么!

谁能建议我怎么做?

我的 logcat 错误

    02-11 12:03:49.744 613-650/? W/qcom_sensors_hal: hal_sensor1_data_cb: SENSOR1_MSG_TYPE_BROKEN_PIPE
02-11 12:03:49.803 12473-12473/? E/Diag_Lib:  Diag_LSM_Init: Failed to open handle to diag driver, error = 2
02-11 12:03:49.803 12473-12473/? E/Sensors: sns_fsa_la.c(386):fsa: fflush failed, 9
02-11 12:03:49.803 12473-12473/? E/Sensors: sns_fsa_la.c(386):fsa: fflush failed, 9
02-11 12:03:49.835 12473-12475/? W/Sensors: sns_smr_la.c(446):smr_la: smr_apps_la_thread_main is starting, fd=11, sns_smr.en_rx_msg_ptr=b6feba04
02-11 12:03:49.917 12473-12477/? W/Sensors: sns_sam_app.c(6827):sns_sam_reg_algo: Registering algo service 16, err 0
02-11 12:03:49.928 12473-12479/? E/Sensors: sns_debug_main.c(565):Debug Config File missing in EFS!

上周我测试了此代码以获取通知,但现在它无法正常工作,而且我没有更改该代码部分中的任何内容。

我的网格文件(应用程序)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.flaviofaria:kenburnsview:1.0.7'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.squareup.okhttp3:okhttp:3.2.0'
    implementation 'com.nex3z:notification-badge:0.1.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:gridlayout-v7:26.1.0'
}
apply plugin: 'com.google.gms.google-services'

网格文件(项目)

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

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:3.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

【问题讨论】:

  • 请发布您的 build.gradle 文件文件可能存在一些依赖冲突
  • 我已经发布了兄弟请检查他们
  • firebase-core 依赖项在您的 gradle 文件中重复。
  • 首先检查无效缓存/从android studio中的文件菜单重新启动
  • 如果不工作,那么你可以关注这个gist.github.com/Muhaiminur/f0d05f53fb2b0f5a6f3419c6514f0ca5

标签: android firebase firebase-notifications


【解决方案1】:

用最新的更新你的文件

implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-core:17.3.4'
implementation 'com.google.firebase:firebase-core:17.3.4'

【讨论】:

    猜你喜欢
    • 2021-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多