apache / apache/cordova-plugin-inappbrowser
IllegalArgumentException when closing InAppBrowser on android
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
We are facing a crash (reported from Google Play Console), that is happening on some phones, mentioned InAppBrowser in the stack trace.
The app seems to be crashing when closing the in-app browser. I see that a very similar issue was closed in https://github.com/apache/cordova-plugin-inappbrowser/pull/616 but we're using plugin version 5 and the issue was still experienced by a user last week.
## Information
We could not reproduce the issue on our devices, I'm sharing screenshots from the console.


### Logs
```
Exception java.lang.IllegalArgumentException:
at android.view.WindowManagerGlobal.findViewLocked (WindowManagerGlobal.java:529)
at android.view.WindowManagerGlobal.removeView (WindowManagerGlobal.java:438)
at android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:126)
at android.app.Dialog.dismissDialog (Dialog.java:375)
at android.app.Dialog.dismiss (Dialog.java:358)
at org.apache.cordova.inappbrowser.InAppBrowser$6$1.onPageFinished (InAppBrowser.java:534)
at YM4.a (chromium-Monochrome.aab-stable-:425)
at CA.handleMessage (chromium-Monochrome.aab-stable-:220)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:201)
at android.app.ActivityThread.main (ActivityThread.java:6810)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
```
### Environment, Platform, Device
Android 9 (SDK 28), Xiaomi Redmi Note 5 Pro.
### Version information
cordova-plugin-inappbrowser: v5.0.0
cordova android version: ^10,0,0
Ionic:
Ionic CLI : 5.4.16
Ionic Framework : @ionic/angular 6.5.1
@angular-devkit/build-angular : 14.2.10
@angular-devkit/schematics : 14.2.10
@angular/cli : 14.2.10
@ionic/angular-toolkit : 6.1.0
Cordova:
Cordova CLI : 11.0.0
Cordova Platforms : android 10.1.2
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 27 other plugins)
Utility:
cordova-res : 0.15.4
native-run : 1.7.2
System:
Android SDK Tools : 26.1.1 (C:\Users\pcadm\AppData\Local\Android\Sdk)
NodeJS : v16.10.0 (C:\Program Files\nodejs\node.exe)
npm : 7.24.0
OS : Windows 10
## Checklist
- [x] I searched for existing GitHub issues (Found an old issue but as far as I understand, version 5 of the plugin we use already has this fix)
- [ ] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start in InAppBrowser.java at line 534, where the stack trace shows the page-finished callback dismissing the dialog. Compare this close path with the behavior addressed in pull request 616 and investigate the Android 9 failure reported on the Xiaomi device. Done means closing the in-app browser no longer raises IllegalArgumentException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100