Why does Android OS 8 WebVew with HTML select tag crash the app

前端 未结 9 2636
傲寒
傲寒 2020-12-15 20:24

I\'ve got a hybrid Cordova Android app, and the app crashes when user tap on a drop-down box in my WebView running on Android OS 8. I\'ve created a simple page

9条回答
  •  难免孤独
    2020-12-15 21:06

    In AndroidX land (limited to a minimum compileSDKVersion 28), I was also getting this issue on a Marshmallow emulator with a popup spinner. I don't go anywhere near Resources so this is still a platform issue with one of the support libs.

    I managed to get it working - not by moving the webview to an Activity (although I did try that, it was unnecessary), - but by adding it programmatically with a wrapped context and a standard AppCompat theme:

    val webView = WebView(ContextThemeWrapper(activity, R.style.Theme_AppCompat_Light))
    binding.webViewContainer.addView(webView)
    

    I don't understand wtf is going on here but right now it works. Good luck people!

    EDIT I have looked into this a lot more and found the dependency which is causing issues for me. A particular version of the material components library is actually inducing this in webviews (1.1.0-alpha06 to be precise). I have asked a question on it here, with a sample project.

提交回复
热议问题