Android Azure通知中心-从令牌提供程序获取的令牌错误

Android Azure通知中心-从令牌提供程序获取的令牌错误,android,azure,firebase,push-notification,azure-notificationhub,Android,Azure,Firebase,Push Notification,Azure Notificationhub,我遵循了在Android上设置推送通知的教程() 我能够成功注册到通知(按照添加代码->15中的要求) 问题是,当我转到azure通知中心并对Android平台执行“测试发送”时,“结果”是“从令牌提供商获得的令牌错误”。我不明白为什么会这样 我无法在我的android应用程序上设置断点,也无法查看消息的接收位置。我已经创建了一个扩展FirebaseMessagingService的类,并在MessageReceived(RemoteMessage RemoteMessage)上覆盖了publ

我遵循了在Android上设置推送通知的教程()

我能够成功注册到通知(按照添加代码->15中的要求)

问题是,当我转到azure通知中心并对Android平台执行“测试发送”时,“结果”是“从令牌提供商获得的令牌错误”。我不明白为什么会这样

我无法在我的android应用程序上设置断点,也无法查看消息的接收位置。我已经创建了一个扩展
FirebaseMessagingService
的类,并在MessageReceived(RemoteMessage RemoteMessage)上覆盖了
public void,但这个类似乎从未受到攻击

我无法确定从何处、如何或为什么返回此错误

编辑:

应用程序Gradle

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias 'xxx'
            keyPassword 'xxx'
            storeFile file('../Keys/dev-release.jks')
            storePassword 'xxx'
        }
    }

    compileSdkVersion 27

    defaultConfig {
        applicationId "xxx"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 9
        versionName "0.09"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    // REF: https://michiganlabs.com/2014/09/23/string-constants-generated-gradle-build-configurations/
    buildTypes {
        release {
            /*debuggable true*/
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config

            buildConfigField("String", "GOOGLE_ANALYTICS_TRACKING_ID", "\"xxx\"")
        }

        debug {
            buildConfigField("String", "GOOGLE_ANALYTICS_TRACKING_ID", "\"xxx\"")
        }
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url 'https://maven.google.com' }
        maven { url "http://dl.bintray.com/microsoftazuremobile/SDK" }
    }
}

ext.support_version = '27.1.1'
ext.lifecycle_version = '1.1.1'
ext.firebase_version = '15.0.2'
ext.glide_version = '4.7.1'
ext.smart_tab_layout_version = '1.6.1'

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation 'com.github.warkiz.widget:indicatorseekbar:1.2.9'

    implementation 'joda-time:joda-time:2.9.9'

    implementation 'com.github.PierfrancescoSoffritti:AndroidYouTubePlayer:6.0.0'

    implementation 'com.thoughtbot:expandablerecyclerview:1.4'

    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

    implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'

    implementation 'de.hdodenhof:circleimageview:2.2.0'

    implementation 'com.mindorks:placeholderview:0.7.3'

    implementation 'com.yarolegovich:discrete-scrollview:1.4.7'

    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'

    implementation 'com.facebook.android:facebook-login:4.33.0'

    implementation 'com.google.code.gson:gson:2.8.2'

    implementation 'com.microsoft.azure:azure-mobile-android:3.4.0@aar'
    implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
    implementation 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'

    implementation 'com.google.guava:guava:25.0-android'

    implementation 'com.daimajia.swipelayout:library:1.2.0@aar'

    implementation 'com.alexvasilkov:gesture-views:2.5.2'

    implementation 'com.google.zxing:core:3.3.2'
    implementation 'com.journeyapps:zxing-android-embedded:3.6.0@aar'
    implementation 'me.dm7.barcodescanner:zxing:1.9.8'

    implementation 'com.squareup.okhttp3:okhttp:3.10.0' // 'com.squareup.okhttp:okhttp:2.7.5'
    implementation 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' // REF: https://github.com/square/okhttp/issues/879
    implementation 'com.squareup.mimecraft:mimecraft:1.1.1'

    implementation "com.ogaclejapan.smarttablayout:library:$smart_tab_layout_version@aar"
    implementation "com.ogaclejapan.smarttablayout:utils-v4:$smart_tab_layout_version@aar"

    // REF: https://developers.google.com/cloud-messaging/android/android-migrate-fcm
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation "com.google.firebase:firebase-messaging:17.0.0"

    implementation "com.google.android.gms:play-services-analytics:16.0.0"
    implementation "com.google.firebase:firebase-core:16.0.0"
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'

    implementation "com.android.support:cardview-v7:$support_version"
    implementation "com.android.support:animated-vector-drawable:$support_version"
    implementation "com.android.support:design:$support_version"
    implementation "com.android.support:customtabs:$support_version"
    implementation "com.android.support:exifinterface:$support_version"
    implementation "com.android.support:appcompat-v7:$support_version"
    implementation "com.android.support:design:$support_version"
    implementation "com.android.support:support-v4:$support_version"
    implementation "com.android.support:recyclerview-v7:$support_version"
    implementation "com.android.support:support-v4:$support_version"
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'

    annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"

    annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
    implementation "com.github.bumptech.glide:glide:$glide_version"

    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    testImplementation 'junit:junit:4.12'
}

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()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.3.0'

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

allprojects {
    repositories {
        google()
        jcenter()

        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

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

您需要在最新版本(Project grandle)中更改google服务:

我建议您不要使用特定版本的firebase库,因此请确保您使用的是基于的最新版本,请检查以下实现:

    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-analytics:16.0.0'
    implementation 'com.google.firebase:firebase-appindexing:15.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-firestore:17.0.1'
    implementation 'com.google.firebase:firebase-functions:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-crash:16.0.0'
    implementation 'com.google.firebase:firebase-invites:16.0.0'
    implementation 'com.google.firebase:firebase-perf:16.0.0'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-config:16.0.0'

我发现项目文件中有多个“googleservices.json”文件。删除不正确的文件并更新剩余的文件解决了问题。

您能为我们提供grandle文件吗?添加了gradle文件,我更新了所有最新版本,但仍然存在相同的问题,unfortunately@StefanKairinos也检查一下这个答案,
    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-analytics:16.0.0'
    implementation 'com.google.firebase:firebase-appindexing:15.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-firestore:17.0.1'
    implementation 'com.google.firebase:firebase-functions:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-crash:16.0.0'
    implementation 'com.google.firebase:firebase-invites:16.0.0'
    implementation 'com.google.firebase:firebase-perf:16.0.0'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-config:16.0.0'