有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

安卓的问题。getToken()java。木卫一。IOException:无效的\u目标\u版本

gettoken()在Android 10中抛出无效的\u目标\u版本错误 我使用了这个依赖项和这个方法

implementation platform('com.google.firebase:firebase-bom:28.4.2')
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-analytics'

FirebaseMessaging.getInstance().subscribeToTopic(topic).addOnCompleteListener((task) -> {
    if (!task.isSuccessful()) {

        return;
    }
});

FirebaseMessaging.getInstance().getToken().addOnCompleteListener((task)-> {
  if (!task.isSuccessful()) {
    return;
  }

  // Get new FCM registration token
  String token = task.getResult();

});

这是错误内容

E/FirebaseMessaging: Failed to sync topics. Won't retry sync. INVALID_TARGET_VERSION
D/IMI: =====> Fetching FCM registration token failed java.io.IOException: INVALID_TARGET_VERSION
W/System.err: java.io.IOException: INVALID_TARGET_VERSION
        at com.google.firebase.iid.GmsRpc.handleResponse(com.google.firebase:firebase-iid@@21.0.1:7)
        at com.google.firebase.iid.GmsRpc.lambda$extractResponseWhenComplete$0$GmsRpc(Unknown Source:8)
        at com.google.firebase.iid.GmsRpc$$Lambda$0.then(Unknown Source:2)
        at com.google.安卓.gms.tasks.zzc.run(com.google.安卓.gms:play-services-tasks@@17.2.1:3)
        at com.google.firebase.iid.FirebaseIidExecutors$$Lambda$0.execute(Unknown Source:0)
        at com.google.安卓.gms.tasks.zzd.zza(com.google.安卓.gms:play-services-tasks@@17.2.1:1)
        at com.google.安卓.gms.tasks.zzr.zzb(com.google.安卓.gms:play-services-tasks@@17.2.1:5)
        at com.google.安卓.gms.tasks.zzw.zza(com.google.安卓.gms:play-services-tasks@@17.2.1:3)
        at com.google.安卓.gms.tasks.zzc.run(com.google.安卓.gms:play-services-tasks@@17.2.1:8)
        at com.google.安卓.gms.cloudmessaging.zzz.execute(Unknown Source:0)
        at com.google.安卓.gms.tasks.zzd.zza(com.google.安卓.gms:play-services-tasks@@17.2.1:1)
        at com.google.安卓.gms.tasks.zzr.zzb(com.google.安卓.gms:play-services-tasks@@17.2.1:5)
        at com.google.安卓.gms.tasks.zzw.zza(com.google.安卓.gms:play-services-tasks@@17.2.1:3)
        at com.google.安卓.gms.tasks.TaskCompletionSource.setResult(com.google.安卓.gms:play-services-tasks@@17.2.1:1)
        at com.google.安卓.gms.cloudmessaging.zzq.zza(com.google.安卓.gms:play-services-cloud-messaging@@16.0.0:9)
        at com.google.安卓.gms.cloudmessaging.zzs.zza(com.google.安卓.gms:play-services-cloud-messaging@@16.0.0:7)
        at com.google.安卓.gms.cloudmessaging.zzf.zza(com.google.安卓.gms:play-services-cloud-messaging@@16.0.0:45)
        at com.google.安卓.gms.cloudmessaging.zzi.handleMessage(Unknown Source:2)
        at 安卓.os.Handler.dispatchMessage(Handler.java:102)
        at 安卓.os.Looper.loop(Looper.java:247)
        at 安卓.app.ActivityThread.main(ActivityThread.java:8656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.安卓.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
        at com.安卓.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

我遵循了这个例子,但我不理解这个错误的内容。我有什么问题


共 (0) 个答案