Android WebView InflateException on android 7.0 - android

I have WebView on my application and I got many same errors on android 7.0 from users while inflating WebView fragment.
Error log:
android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class android.webkit.WebView
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class android.webkit.WebView
WebView fragment layout:
<android.support.v7.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background">
<WebView
android:id="#+id/wvAparat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="16dp" />
</android.support.v7.widget.LinearLayoutCompat>
I got this error from these devices:
SM-G950F Android 7.0
SM-J330F Android 7.0
Moto E (4) Plus Android 7.1.1

It's definitely device related. here is a link for more information:
https://www.androidpolice.com/2016/07/20/google-explains-chrome-will-become-webview-android-7-0/
My hunch would be, if you find one of these devices, to check if they have Chrome installed. If not, that's your answer. No idea for a workaround.

Related

Android studio error inflating constraint layout

Android studio drops
"android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.ConstraintLayout"
error when i run my app on Android Marshmallow or below. It perfectly works on nougat and oreo
I added "implementation 'com.android.support.constraint:constraint-layout:1.1.0'" as i saw it in other answers but it still not works
xml:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/soros3"
android:padding="0dp"
tools:co0-ntext=".MainActivity">
please help
ok
So I removed the background of the layout and removed the
tools:co0-ntext=".MainActivity"
line and it works.
I don't really know why but it works

Exception when trying to use a <vector> as src for an ImageView

I have in one of my layout files.
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
app:srcCompat="#drawable/ic_app"
android:layout_gravity="center"/>
My ic_app.xml is located in flavor/res/drawable. I notice that if I move the icon into main/res/drawable. Everything is working again!
The drawable ic_app is an XML. But for some reason, my android API-23 phone would crash whenever this activity is launched that contains this ImageView. Saying that the resource is not found.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.app.android.view.activity.login.WelcomeActivity}: android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class ImageView
Caused by: android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class ImageView
Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class ImageView
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_app.xml from drawable resource ID #0x7f02029e
I have never seen this happening before. What could the cause be?
The same app runs correctly in an API-19 device.
If you are using vector drawables, use
app:srcCompat="#drawable/ic_app"
instead of
android:src="#drawable/ic_app"
Here is a Good Read
Try to use app:srcCompat="#drawable/ic_app" instead of android:src="#drawable/ic_app".
I've found this
Firstly, when using AppCompat with ImageView (or subclasses such as ImageButton and FloatingActionButton), you’ll be able to use the new app:srcCompat attribute to reference vector drawables (as well as any other drawable available to android:src):
On this Blog

android 8.0 user-defined view Application Crash

When I use my application in Android 8.0, it crashes. Here is the log:
android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class com.**.**.XListView
android.view.InflateException: Binary XML file line #7: Error inflating class com.****
java.lang.ClassNotFoundException: Can't find class com.****. installed bundles
The *** was hidden by me.
XListView is a user-defined view that extends ListView.
But when I use the application on a lower version, like Android 7.1, 7.0, 6.0, 5.0... it works normally.
What can I do to resolve it?

Android Studio error "android.view.InflateException: Binary XML file line #26: Error inflating class " when trying to use GeckoView

So, I'm trying to use GeckoView in my Android app. When I run my app I get this error:
"Process: com.example.planetarium_3d, PID: 1586
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.planetarium_3d/com.example.planetarium_3d.Fullscree nActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class org.mozilla.gecko.GeckoView"
I've placed the .jar files in my libs folder - !http://i.imgur.com/kSFwHzd.png?1
This is my code: http://pastebin.com/kGCjfuAC
This is my activity xml file: http://pastebin.com/s8GYnucS
And this is error log: http://pastebin.com/2yXR6imZ
How can I resolve this issue ?
Exception:
android.view.InflateException: Binary XML file line #26: Error
inflating class org.mozilla.gecko.GeckoView"
Inside your Activity xml file, you dont need class = "org.mozilla.gecko":
<org.mozilla.gecko.GeckoView
android:id="#+id/geckoViewObj"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>

Android Error inflating class TextInputLayout

I'm trying to use TextInputLayout in my XML, and I'm meeting this error :
java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.jechange.moncompte/fr.jechange.moncompte.SignUpActivity}: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.design.widget.TextInputLayout
[...]
Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.design.widget.TextInputLayout
[...]
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/design/R$styleable;
I've imported the design library, and the support-v7-appcompat library. And I'm using the Theme.AppCompat.Light.NoActionBar theme.
The XML in which I'm using the Text Input Layout contains just something like that:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:res="http://schemas.android.com/apk/res-auto"
style="#style/matchParent">
<android.support.design.widget.TextInputLayout
android:id="#+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
if you are calling layout(containg TextInputLayout) from activity then
nothing just use YouActivityClassName.this in place of getApplicationcontext or YourApplicationClassName.getcontext() or other where you are passing context
I had the same issue fixed here.
Make sure you don't have any other support library import v4 and v7. You can use only the design-support library. Also you should make sure your theme "matchParent" inherit from Theme.AppCompat for all the platform you trying to run.
My issue was only on Lollipop because of the values-21/style.xml.
Hope it will help.

Categories

Resources