Play Game Services - BaseGameUtils - android.view.WindowMana



我遇到这个问题已经有一段时间了,而且随着下载量的增加,这个问题也在增加。

它发生在showActivityResultError((中,它为Google的Play游戏服务的连接问题打开了一个错误对话框。我测试了默认情况("没有有意义的活动响应代码,因此生成默认的Google Play服务对话框"(,这在我的手机上工作正常。

一件事 - GooglePlayServicesUtil.isGooglePlayServicesAvailable和GooglePlayServicesUtil.getErrorDialog都显示已贬值,但我找不到任何更新 - 每个人都使用BaseGameUtils作为他们的排行榜/成就吗?

发生在Android 版本 4.2/4.4/5.0/5.1/6.0上,所以那里没有真正的线索。

顶级设备: Galaxy Note4 (tre3g(/GalaxyGrand Neo Plus (grandneove3g(/Galaxy Note3 (ha3g(/Galaxy J7(2016( (j7xelte(/Galaxy Tab4 7.0 (degaswifiue(/Galaxy Note4 (trlte(/Galaxy Grand Prime (grandprimeve3g(/Galaxy S6 Edge (zerolte(

BaseGameUtils的源代码可以在这里查看: https://github.com/playgameservices/android-basic-samples/blob/master/BasicSamples/libraries/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/BaseGameUtils.java

干杯!

java.lang.RuntimeException: 
at android.app.ActivityThread.deliverResults(ActivityThread.java:4019)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4062)
at android.app.ActivityThread.access$1400(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1483)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5930)
at java.lang.reflect.Method.invoke(Method.java:0)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Caused by: android.view.WindowManager$BadTokenException: 
at android.view.ViewRootImpl.setView(ViewRootImpl.java:574)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:282)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:298)
at com.google.example.games.basegameutils.BaseGameUtils.showActivityResultError(BaseGameUtils.java:154)
at <my game here>

我终于找到了答案,这是一个非常简单的修复。它实际上与在活动完成过程中调用 Dialog.show(( 有关。这里描述得很好: http://dimitar.me/android-displaying-dialogs-from-background-threads/

解决方法只是简单地将if(!activity.isFinishing())打电话前Dialog.show();

就我而言,它是在之前errorDialog.show();在方法showActivityResultError()BaseGameUtils.java

丹特是吧。每周有几个例外已经消失。

最新更新