InflateException: Error inflating class fragment - android

My application runs fine on API level 18+. But, when I run it on API 18, it crashes with following exception:
java.lang.RuntimeException: Unable to start activity ComponentInfo
{navdrawer.test.com.navigationdrawertest/navdrawer.test.com.navigationdrawertest.MainActivity}:
android.view.InflateException: Binary XML file line #111: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2362)
at android.app.ActivityThread.access$700(ActivityThread.java:168)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5493)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1225)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #111: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:804)
(many similar exception lines)
Caused by: java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been called.
at android.widget.ListView.addHeaderView(ListView.java:265)
at android.widget.ListView.addHeaderView(ListView.java:294)
(many similar exception lines)
i'm try on this site
What am I doing wrong?

Check your relevant xml file where you might use wrong attribute which is not supported in Api 18

Related

Crash on Android using Chrome WebView regarding ChromeColors & resources

I recently saw a crash while starting a WebView:
2021-10-08 12:55:56.478 26503-26503/? E/cr_WarmupManager: Inflation exception.
android.view.InflateException: Binary XML file line #26: Binary XML file line #11: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
...
Caused by: java.lang.IllegalArgumentException: ChromeColors requires a value for the com.android.chrome:attr/0_resource_name_obfuscated attribute to be set in your app theme. You can either set the attribute in your theme or update your theme to inherit from Theme.MaterialComponents (or a descendant).
at y12.c(chromium-Monochrome.aab-stable-460606123:5)
at i00.b(chromium-Monochrome.aab-stable-460606123:4)
at org.chromium.chrome.browser.compositor.CompositorView.g(chromium-Monochrome.aab-stable-460606123:5)
at org.chromium.chrome.browser.compositor.CompositorView.<init>(chromium-Monochrome.aab-stable-460606123:5)
at org.chromium.chrome.browser.compositor.CompositorViewHolder.<init>(chromium-Monochrome.aab-stable-460606123:15)
Have you seen anything similar? Could it be due to a WebView update?

Errors after uploading to Google playstore

My app runs perfectly when I run it using Android studio.
When I uploaded the app to the playstore, I started getting the following error:
12-19 13:42:14.971 18767-18767/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.djulie.acs.djulie_driver_new, PID: 18767
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.djulie.acs.djulie_driver_new/com.djulie.acs.djulie_driver_new.Menu.MainMenu}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3255)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3351)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1796)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7230)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class ImageView
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at android.support.v7.app.ae.b(Unknown Source)
at android.support.v7.app.p.setContentView(Unknown Source)
at com.djulie.acs.djulie_driver_new.Menu.MainMenu.onCreate(Unknown Source)
I have add this code to the OnCreate event method, but it is still not working
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
thanks in advance for your help.
You have to add AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); like this
public class Login extends AppCompatActivity {
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
//then your onCreate method will be start
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
problem solved by deleting ProGuard

CAST - Error inflating class android.widget.ImageButton

I have been using ChromeCast in my application before and it was working great. Recently I added Google Cloud Messaging in my application too, and for that I had to update dependency files to
'com.google.android.gms:play-services-cast:8.3.0' and 'com.google.android.gms:play-services-gcm:8.3.0'. But now when client disconnects chromecast we get the following fatal exceptions and the application crashes.
11-23 12:42:49.415 22117-22117/com.jadoo.jadooplus E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.jadoo.jadooplus, PID: 22117
android.view.InflateException: Binary XML file line #36: Error inflating class android.widget.ImageButton
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:315)
at android.app.Dialog.setContentView(Dialog.java:512)
at android.support.v7.app.MediaRouteControllerDialog.onCreate(MediaRouteControllerDialog.java:178)
at android.app.Dialog.dispatchOnCreate(Dialog.java:396)
at android.app.Dialog.show(Dialog.java:268)
at android.support.v4.app.DialogFragment.onStart(DialogFragment.java:399)
at android.support.v4.app.Fragment.performStart(Fragment.java:1813)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:989)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:458)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5105)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
preceded by an InvocationTargetException and Resources$NotFoundException.
Even now when I change the version anywhere below 7.5.x the code works great. Any ideas why ImageButton is not drawable. I've spent a day at following the stacktrace and today surfing the web, no luck. I haven't found anything useful on the topic.
I applologize for not posting stacktrace from other exception' stacktrace but I can't add more in formatted code.
Edit 1: I can't seem to add any more code here so here's a snapshot:
Edit 2:
I have already tried disabling Proguard, with no effect. The issue persists on a LG G2 d802, a range of Samsung Tabs and Nexus 7. Also I am not using CastCompanionLibrary.

My app crashes on lg devices when I am clicking the ad

My app crashes on LG devices when I am clicking the ad (from admob)!. What's the problem?
android.view.InflateException: Binary XML file line #21: Error inflating class <unknown> at
android.view.LayoutInflater.createView(LayoutInflater.java:613) at
com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) at
android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) at
android.view.LayoutInflater.inflate(LayoutInflater.java:466) at
android.view.LayoutInflater.inflate(LayoutInflater.java:396) at
android.view.LayoutInflater.inflate(LayoutInflater.java:352) at
com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3090) at
com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3150) at
com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1737) at
android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2683) at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2124) at
android.app.ActivityThread.access$600(ActivityThread.java:138) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1204) at
android.os.Handler.dispatchMessage(Handler.java:99) at
android.os.Looper.loop(Looper.java:137) at
android.app.ActivityThread.main(ActivityThread.java:4952) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:511) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561) at
dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException at
java.lang.reflect.Constructor.constructNative(Native Method) at
java.lang.reflect.Constructor.newInstance(Constructor.java:417) at
android.view.LayoutInflater.createView(LayoutInflater.java:587) ... 21 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=7; index=-1 at
android.view.View.<init>(View.java:3638) at
android.view.ViewGroup.<init>(ViewGroup.java:427) at
android.widget.LinearLayout.<init>(LinearLayout.java:176) at
android.widget.LinearLayout.<init>(LinearLayout.java:172) ... 24 more
..................................................................................................
It's issue with LG Optimus L9 P760 device. It occurs only on version 4.1.2, I see it every now and then in my apps. If your application is available on any store and it's serious problem to you remember that you can always disable this device from supported devices.
I don't think there's anything to worry about. In my case the layout isn't complicated so the solution proposed by #Kishan with flattening view hierarchy will not work. It's just manufacturer fault.
This same error was there in my previous application. its because of the internal memory stack of the device (Some thing like RAM) is full. so for overcoming this error see the hierarchy of layout. and see the time of inflating in the hierarchy view if android eclipse IDE. and decrease the hierarchy of the layout. i have solved my issue with this. so you can check this if you can solve by the same solution.
Hope you can understand this solution.

Some mobile phone gets the error "android.view.InflateException: Binary XML file "of SlidingMenu

My app is all right on most of the phone.However,on some kinds of phone,it will get the error below:
android.view.InflateException: Binary XML file line #2: Error inflating class com.jeremyfeinstein.slidingmenu.lib.SlidingMenu
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1686)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1702)
at android.app.ActivityThread.access$1600(ActivityThread.java:118)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:952)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3768)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.jeremyfeinstein.slidingmenu.lib.SlidingMenu
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.jeremyfeinstein.slidingmenu.lib.app.a.a(Unknown Source)
at com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity.onCreate(Unknown Source)
at com.qingdaonews.bus.BaseActivity.onCreate(Unknown Source)
at com.qingdaonews.activity.MainActivity.onCreate(Unknown Source)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1046)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1650)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
... 21 more
Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
at android.view.View.(View.java:2096)
at android.view.ViewGroup.(ViewGroup.java:294)
at android.widget.RelativeLayout.(RelativeLayout.java:178)
at com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.(Unknown Source)
at com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.(Unknown Source)
And this phone's Android version is 2.3.5 which my app is support(It's fine on other 2.3.5 phones).So I'm confused about that why only this kind of phone will get the error and I don't know how to fix it.
The xml of layout is ver sample:
<?xml version="1.0" encoding="utf-8"?>
<com.jeremyfeinstein.slidingmenu.lib.SlidingMenu xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/slidingmenumain"
android:layout_width="fill_parent"
android:layout_height="fill_parent" /><br>
And the main class is here jfeinstein10 slidingmenu
It says you are using some of the API which doesn't exist on 2.3.5.
Do you use some attributes of the RelativeLayout in your sliding menu layout which do not exist on previous Android versions? Such as android:layout_alignParentEnd for instance
For Android Studio 3.0.1
I have got the same issue and I have resolved finally Opening the gradle.properties and added following line:
android.enableAapt2=false

Categories

Resources