After uploading my app to Closed testing, I got an error in the Pre_launch report. How can I find out where it is in the code?
B4X:
Exception android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@18f5719 is not valid; is your activity running?
at android.view.ViewRootImpl.setView (ViewRootImpl.java:1189)
at android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:400)
at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:139)
at android.app.Dialog.show (Dialog.java:348)
at anywheresoftware.b4a.keywords.Common.showAndTrackDialog (Common.java:591)
at anywheresoftware.b4a.keywords.Common.Msgbox2Async (Common.java:502)
at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.MsgboxAsync (B4XViewWrapper.java:807)
at cz.flashcards3000.tools._catcherror (tools.java:44)
at cz.flashcards3000.b4xmainpage._progresscourse (b4xmainpage.java:1409)
at cz.flashcards3000.b4xmainpage$ResumableSub_B4XPage_Created.resume (b4xmainpage.java:288)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent (BA.java:275)
at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:215)
at anywheresoftware.b4a.keywords.Common$12.run (Common.java:1212)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:7870)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)
What always works without having any idea what and how you want to achieve: Just put some log(1), log(2), log(n) statements in your code and see at which number the logging stops. Then put a break after that in your code and follow the execution step by step until the error .
To be clear - I don't get any errors when running the app. The above error is shown in Google Play Console after uploading the app. I don't know how it works exactly, but Google probably tests the app on virtual devices and then shows the results in Testing > Pre-launch report. And this is where I got some errors from this testing.
From the stack trace it looks like your code is trying, and failing for some reason, to display a Msgbox2Async during your B4XMainPage creation. It is possibly a timing problem The key may be this "is your activity running?"
Your main page activity may not be running at this time and so cannot show a dialog.