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

Posted

技术标签:

【中文标题】如何解决“令牌检索失败:AUTHENTICATION_FAILED”?【英文标题】:how to solve "Token retrieval failed: AUTHENTICATION_FAILED"? 【发布时间】:2019-10-02 14:55:53 【问题描述】:

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

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)

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

这里是项目等级:

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>

没有生成令牌...每次运行应用程序时都会向我显示上述错误。 我试过清除所有这些......有什么帮助吗??

【问题讨论】:

你修好了吗? 这是一些插件版本问题,我找不到但我更新了插件,现在工作正常。 @NilxSingh 对 Log 中的相同消息有同样的问题。可以提供更新后得到的插件版本吗?谢谢 【参考方案1】:

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

【讨论】:

以上是关于如何解决“令牌检索失败:AUTHENTICATION_FAILED”?的主要内容,如果未能解决你的问题,请参考以下文章

如何解决包冲突问题

如何解决包冲突问题

如何解决ajax跨域问题

MySQL 的 10048问题,如何解决?

如何解决smartgit的冲突问题

如何解决https传输图片的问题