android - 如何解决 "Token retrieval failed: AUTHENTICATION_FAILED"?

标签 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'

我的 list 文件:

> <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>

没有生成 token ...每次运行应用程序时都会显示上述错误。 我试过清理等等……有什么帮助吗??

最佳答案

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

关于android - 如何解决 "Token retrieval failed: AUTHENTICATION_FAILED"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56149754/

相关文章:

Android AlertDialog - 如何处理超大消息?

angular - 如何更改 Cloud Firestore 中数组内的对象?

javascript - HTML5 表单验证无需提交

android - Flutter:使用 minifyEnabled 的 Release模式下的 Firestore 不可用错误

layout - Flutter LinearLayout 权重替代

java - 协议(protocol)异常不支持的地址族

android - Firebase Android Auth 对象没有触发回调

java - Android Studio的Gradle Sync(SDK)问题

flutter - 我如何在 flutter [go router] 中使用 go router 插件进行推送替换

ios - iOS 的 Codemagic 自动应用程序签名失败