apache / cordova-plugin-inappbrowser

Apache Cordova InAppBrowser Plugin
https://cordova.apache.org/
Apache License 2.0
1.12k stars 2.15k forks source link

[Android] Getting BadTokenException #798

Open klliew18 opened 4 years ago

klliew18 commented 4 years ago

Bug Report

Problem

What is expected to happen?

Should not get BadTokenException and crash the app.

What does actually happen?

Detected multiple devices getting this exception. Device info: Samsung Galaxy Note10+, Huawei P30, Oppo Reno, Oppo R17, others

android.view.WindowManager$BadTokenException: at android.view.ViewRootImpl.setView (ViewRootImpl.java:1122) at android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:450) at android.view.WindowManagerImpl.addView (WindowManagerImpl.java:95) at android.app.Dialog.show (Dialog.java:473) at org.apache.cordova.inappbrowser.InAppBrowser$7.run (InAppBrowser.java:1083) at android.app.Activity.runOnUiThread (Activity.java:6974) at org.apache.cordova.inappbrowser.InAppBrowser.showWebPage (InAppBrowser.java:1093) at org.apache.cordova.inappbrowser.InAppBrowser$1.run (InAppBrowser.java:251) at android.os.Handler.handleCallback (Handler.java:883) at android.os.Handler.dispatchMessage (Handler.java:100) at android.os.Looper.loop (Looper.java:237) at android.app.ActivityThread.main (ActivityThread.java:8016) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1076)

Environment, Platform, Device

Installed platforms: android 9.0.0 ios 5.1.1

Version information

cordova-clipboard 1.3.0 "Clipboard" cordova-custom-config 5.1.0 "cordova-custom-config" cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport" cordova-plugin-advanced-http 2.5.1 "Advanced HTTP plugin" cordova-plugin-android-imei 1.0.0 "Android IMEI" cordova-plugin-app-version 0.1.9 "AppVersion" cordova-plugin-call-number 1.0.1 "Cordova Call Number Plugin" cordova-plugin-device 2.0.3 "Device" cordova-plugin-email 1.2.7 "EmailComposer" cordova-plugin-exit 1.0.3 "Exit" cordova-plugin-file 6.0.2 "File" cordova-plugin-fingerprint-aio 2.0.0 "FingerprintAllInOne" cordova-plugin-firebasex 11.0.1 "Google Firebase Plugin" cordova-plugin-inappbrowser 4.0.0 "InAppBrowser" cordova-plugin-iroot 0.8.1 "iRoot" cordova-plugin-market 1.2.0 "Market" cordova-plugin-nativestorage 2.3.2 "NativeStorage" cordova-plugin-network-information 2.0.2 "Network Information" cordova-plugin-networkinterface 2.0.0 "NetworkInterface" cordova-plugin-privacyscreen-storyboard 0.3.1 "PrivacyScreenPlugin-Storyboard" cordova-plugin-screen-orientation 3.0.2 "Screen Orientation" cordova-plugin-secure-storage-echo 5.1.1 "SecureStorage" cordova-plugin-splashscreen 5.0.4 "Splashscreen" cordova-plugin-statusbar 2.4.3 "StatusBar" cordova-plugin-tapjackingprotection 0.1.1 "TapjackingProtectionPlugin" cordova-plugin-timer 1.0.1 "Native timer" cordova-plugin-touch-id 3.3.1 "Touch ID" cordova-plugin-uniquedeviceid 1.3.2 "UniqueDeviceID" cordova-plugin-whitelist 1.3.4 "Whitelist" cordova-plugin-wkwebview-engine 1.2.1 "Cordova WKWebView Engine" cordova-plugin-wkwebviewxhrfix 0.1.0 "WKWebView XHR Fix" cordova-plugin-x-socialsharing 5.6.8 "SocialSharing" cordova-save-image-gallery 0.0.26 "saveImageGallery" cordova.plugins.diagnostic 5.0.2 "Diagnostic" es6-promise-plugin 4.2.2 "Promise"

Checklist

harirajagopalan commented 3 years ago

Getting the same error across different devices in android.

timbru31 commented 3 years ago

Is this reproducible in a new, plain Cordova app? A minimal reproduction repository would really help to debug and later fix this issue. More information on how to create one: https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md