Skip to content Skip to sidebar Skip to footer

Webview Throws Inflateexception On Android 5.0

After upgrading to 'androidx.appcompat:appcompat:1.0.2' and 'com.google.android.material:material:1.1.0-beta01' the WebView crashes on devices with Android 5.0 and throws this exep

Solution 1:

As explained here, this issue is due to the this revision. It affects Lollipop devices with webview version<50. Use the following code as a solution.

overridefunapplyOverrideConfiguration(overrideConfiguration: Configuration?) {
        if (Build.VERSION.SDK_INT in21..25 && (resources.configuration.uiMode == AppConstants.appContext.resources.configuration.uiMode)) {
                return
        }
        super.applyOverrideConfiguration(overrideConfiguration)
}

Solution 2:

What about your targetSdkVersion and your buildTools version? Once I had a very similar issue. I started seeing this exception when I raised the targetSdkVersion to 25 and the build tools to 25.0.2.

Also try to update your app theme to inherit from Theme.MaterialComponents (or a descendant). Change your AppTheme parent to Theme.MaterialComponents.

Example

Before:

<!-- Base application theme. --><stylename="AppTheme"parent="Theme.AppCompat.Light.DarkActionBar"><!-- Customize your theme here. --></style>

After:

<!-- Material application theme. --><stylename="AppTheme"parent="Theme.MaterialComponents.Light.DarkActionBar"><!-- Customize your theme here. --></style>

Post a Comment for "Webview Throws Inflateexception On Android 5.0"