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

前端 未结 9 2603
傲寒
傲寒 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 20:48

    Its look like you are setting Integer value to the Textview. try using String.valueOf(value) to set value in Textview.

    0 讨论(0)
  • 2020-12-15 20:57

    If anyone is still having this issue, I found that it wasn't even my code that was subclassing the Resources class but rather the Google support library version that I was using. Updated the support library version and it worked like a charm!

    0 讨论(0)
  • 2020-12-15 20:58

    I have same issue on Android 8.0 . finally i solve it. Try to update your compileSdkVersion to 26, and update your com.android.support:appcompat-v7 to 26.

    0 讨论(0)
  • 2020-12-15 20:59

    Looks like this bug: https://issuetracker.google.com/issues/77246450

    Don't subclass resources...won't be fixed apparently.

    0 讨论(0)
  • 2020-12-15 21:04

    Maybe you use custom ContextWrapper in your Activity class. In my case, I override attachBaseContext method. Check this method and use super.attachBaseContext(newBase).

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题