如何解决“令牌检索失败:AUTHENTICATION_FAILED”?

时间:2019-05-15 12:48:50

标签: android firebase flutter push-notification

我已经实现了所有文档,但是仍然出现此错误。

This is my log:
W/FirebaseMessagingPlugin(29848): getToken, error fetching instanceID: 
W/FirebaseMessagingPlugin(29848): java.io.IOException: AUTHENTICATION_FAILED
W/FirebaseMessagingPlugin(29848):   at com.google.firebase.iid.zzs.zza(Unknown Source:71)
W/FirebaseMessagingPlugin(29848):   at com.google.firebase.iid.zzs.zza(Unknown Source:84)
W/FirebaseMessagingPlugin(29848):   at com.google.firebase.iid.zzt.then(Unknown Source:4)
W/FirebaseMessagingPlugin(29848):   at com.google.android.gms.tasks.zzd.run(Unknown Source:5)
W/FirebaseMessagingPlugin(29848):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/FirebaseMessagingPlugin(29848):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/FirebaseMessagingPlugin(29848):   at java.lang.Thread.run(Thread.java:764)

我经历了许多可用的选项,但仍然无法理解问题...

这是项目gradle:

dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
    }

这是应用程序gradle:

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

应用插件:“ com.google.gms.google-services”

我的清单文件:

> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
>     package="com.xyz.com">
> 
>     <!-- The INTERNET permission is required for development. Specifically,
>          flutter needs it to communicate with the running application
>          to allow setting breakpoints, to provide hot reload, etc.
>     -->
>     <uses-permission android:name="android.permission.INTERNET"/>
>     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
>     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
>     <uses-permission android:name="android.permission.CAMERA" />
>     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
>     
> 
>     <!-- io.flutter.app.FlutterApplication is an android.app.Application that
>          calls FlutterMain.startInitialization(this); in its onCreate method.
>          In most cases you can leave this as-is, but you if you want to provide
>          additional functionality it is fine to subclass or reimplement
>          FlutterApplication and put your custom class here. -->
>     <application
>         android:name="io.flutter.app.FlutterApplication"
>         android:label="xyz"
>         android:icon="@mipmap/ic_launcher">
>         <activity
>             android:name=".MainActivity"
>             android:launchMode="singleTop"
>             android:theme="@style/LaunchTheme"
>             android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
>             android:hardwareAccelerated="true"
>             android:windowSoftInputMode="adjustResize">
>             <!-- This keeps the window background of the activity showing
>                  until Flutter renders its first frame. It can be removed if
>                  there is no splash screen (such as the default splash screen
>                  defined in @style/LaunchTheme). -->
>             <meta-data
>                 android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
>                 android:value="true" />
>             
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN"/>
>                 <category android:name="android.intent.category.LAUNCHER"/>
>             </intent-filter>
>             <intent-filter>
>                 <action android:name="FLUTTER_NOTIFICATION_CLICK" />
>                 <category android:name="android.intent.category.DEFAULT" />
>             </intent-filter>
>            
>         </activity>
>         <service
>         android:name="eu.acme.service.FireBaseInstanceIdService"
>         android:exported="false" >
>         <intent-filter>
>             <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
>         </intent-filter>
>         </service>
>         <meta-data android:name="com.google.android.geo.API_KEY"
>                android:value="AIzoUeNddNTMVhPcm9c364781eRse5arovUiKi9Tejs"/>
>     </application> </manifest>

令牌未生成...每次我运行应用程序时,它向我显示以上错误。 我尝试清除所有这些...有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

我已通过将网络适配器的IPV4 DNS从自动更改为8.8.8.8(Google的公共DNS)来解决了此问题