Error Inflating Class Android.webkit.webview Crash On Lollipop When Opening Pdf
In my app I encountered said Error during auto-tests. I'm attempting to show a PDF from an URL in a WebView which causes this crash on devices running Android 5 Lollipop. The full
Solution 1:
It seems that this problem is known when used Android Lollipop.
Did you try these solutions ? android.view.InflateException Error inflating class android.webkit.WebView
Solution 2:
update your appcompat version to 1.2.0-alpha03.
implementation "androidx.appcompat:appcompat:1.2.0-alpha03"
Solution 3:
A bit late, but here is a workaround that should work:
(add to your Activity class that contains the WebView)
@OverridepublicvoidapplyOverrideConfiguration(Configuration configuration) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
&& getResources().getConfiguration().uiMode == WikipediaApp.getInstance().getResources().getConfiguration().uiMode) {
return;
}
super.applyOverrideConfiguration(configuration);
}
Solution 4:
Just add this new dependencies:
implementation 'androidx.appcompat:appcompat:1.2.0-beta01'
implementation 'androidx.appcompat:appcompat-resources:1.2.0-beta01'
The documentation says:
Fixed an issue where androidx.appcompat:appcompat:1.1.0 crashes webview when webview is long pressed (b/141351441)
Solution 5:
You made a mistake when writing.
`WebView webView = view.findViewById(R.id.web_view_license);
It should be WebView = (WebView)view.findViewById(R.id.web_view_license);
Post a Comment for "Error Inflating Class Android.webkit.webview Crash On Lollipop When Opening Pdf"