android.view.InflateException Error inflating class android.webkit.WebView
If you use androidx.appcompat:appcompat:1.1.0
, try androidx.appcompat:appcompat:1.0.2
instead.
it seems that 1.1.0
doesn't fix the bug with WebView
in Android 5.1.1
.
Feb-2020 update: Reverting to 1.0.2
stopped working for many people (including my app), but using the current version of androidx.appcompat:appcompat:1.2.0-alpha02
did fix the crash. (I was seeing it on a Huawei P8 Lite running Android 5.0 during Google's automated "Pre-launch report" testing).
Jun-2020 update: There are newer releases available than the one mentioned in the Feb-2020 update, you can see the currently available versions here:
- https://developer.android.com/jetpack/androidx/releases/appcompat
Error inflating class android.webkit.WebView
I found the issue with the code.
It was related to localization library com.akexorcist:localization:1.2.9
Please check the issues section in github:
https://github.com/akexorcist/Localization/issues/105
Issue is solved in com.akexorcist:localization:1.2.10
Error inflating class android.webkit.WebView happens sporadically in production
If you see these reports from devices running Android Lollipop, please ignore them. This likely happens whenever something launches an activity that uses WebView while the WebView package is in the middle of being updated by Play Store (which can only happen on Lollipop currently). During updates, packages are treated as not installed by the package manager. That is, there is nothing wrong with your app. The time window while the updated package is considered non-existent is typically small, so when the app is relaunched after such a crash, it will start normally.
android.view.InflateException: Binary XML file line #10: Error inflating class android.webkit.WebView
I added a custome WebView class:
public LollipopFixedWebView(Context context) {
super(getFixedContext(context));
}
public LollipopFixedWebView(Context context, AttributeSet attrs) {
super(getFixedContext(context), attrs);
}
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(getFixedContext(context), attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(getFixedContext(context), attrs, defStyleAttr, defStyleRes);
}
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) {
super(getFixedContext(context), attrs, defStyleAttr, privateBrowsing);
}
public static Context getFixedContext(Context context) {
return context.createConfigurationContext(new Configuration());
}
}
Than I changed WebView tag to LollipopFixedWebView. It's worked for me.
WebView throws InflateException on android 5.0
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.
override fun applyOverrideConfiguration(overrideConfiguration: Configuration?) {
if (Build.VERSION.SDK_INT in 21..25 && (resources.configuration.uiMode == AppConstants.appContext.resources.configuration.uiMode)) {
return
}
super.applyOverrideConfiguration(overrideConfiguration)
}
Error inflating class android.webkit.WebView when loading webview
Credit to Tom R for the answer.
In case anybody else encounters a similar problem, check what emulator you are running.
It appears I was running the emulator for Android Wear, more info can be found here on this if you are unaware.
It was fixed by changing this to just the standard ARM CPU
from Wear ARM
Error inflating WebView XML
It seems that something strange ocurred when the app was inflating the WebView, could be whatever.
For the NameNotFoundException: com.google.android.webview
I can deduce that could be a problem with the Google packages (The user could be using a custom ROM and not having them installed.)
If you had more info about the terminal with the error I'll say you go for it, but you have to see the proportion of users/users_with_this_error that you have. Then you could see if it's useful for you work in this issue or not.
From breakline's comment:
Check out this post, looks kinda like the same issue: NameNotFoundException webview
Related Topics
How to Add Javafx Runtime to Eclipse in Java 11
"Integer Number Too Large" Error Message for 600851475143
Java Remove Duplicates from an Array
Strange Floating-Point Behaviour in a Java Program
Individual and Not Continuous Jtable's Cell Selection
Dealing with "Xerces Hell" in Java/Maven
Design Patterns: Factory VS Factory Method VS Abstract Factory
Differencebetween "Class.Forname()" and "Class.Forname().Newinstance()"
Hibernate Opensession() VS Getcurrentsession()
When Should One Use Final for Method Parameters and Local Variables
Why Is "Extends T" Allowed But Not "Implements T"
Natural Sort Order String Comparison in Java - Is One Built In
Eclipse: How to Build an Executable Jar with External Jar
Gson Serialize a List of Polymorphic Objects
Convert an Array of Primitive Longs into a List of Longs
Stale Element Reference: Element Is Not Attached to the Page Document