Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>

Added ActionBarCompat + NavDrawer to my project, running on 4.3 device is smooth, on 2.3 device I get the following exception:

09-08 15:09:15.229: E/AndroidRuntime(2964): FATAL EXCEPTION: main
09-08 15:09:15.229: E/AndroidRuntime(2964): android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.createView(LayoutInflater.java:518)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.AbsListView.obtainView(AbsListView.java:1582)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ListView.makeAndAddView(ListView.java:1801)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ListView.fillDown(ListView.java:724)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ListView.fillFromTop(ListView.java:781)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.ListView.layoutChildren(ListView.java:1652)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.AbsListView.onLayout(AbsListView.java:1412)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:702)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.layout(View.java:7175)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1146)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1866)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.os.Looper.loop(Looper.java:130)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.app.ActivityThread.main(ActivityThread.java:3687)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at java.lang.reflect.Method.invokeNative(Native Method)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at java.lang.reflect.Method.invoke(Method.java:507)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at dalvik.system.NativeStart.main(Native Method)
09-08 15:09:15.229: E/AndroidRuntime(2964): Caused by: java.lang.reflect.InvocationTargetException
09-08 15:09:15.229: E/AndroidRuntime(2964):     at java.lang.reflect.Constructor.constructNative(Native Method)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.LayoutInflater.createView(LayoutInflater.java:505)
09-08 15:09:15.229: E/AndroidRuntime(2964):     ... 35 more
09-08 15:09:15.229: E/AndroidRuntime(2964): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x10102fd a=-1}
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.content.res.Resources.loadDrawable(Resources.java:1681)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.view.View.<init>(View.java:1951)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.TextView.<init>(TextView.java:389)
09-08 15:09:15.229: E/AndroidRuntime(2964):     at android.widget.TextView.<init>(TextView.java:382)
09-08 15:09:15.229: E/AndroidRuntime(2964):     ... 38 more

I've set up everything according to the manual with the right support packages etc...

Any idea ? How can I determine the culprit xml file ?

like image 715
Michael Avatar asked Sep 08 '13 15:09

Michael


1 Answers

Then you add ActionBarCompat to google's Navigation Drawer sample do not forget change native methods to SupportMethods: getActionBar() -> getSupportActionBar(); invalidateOptionsMenu() -> supportInvalidateOptionsMenu(); ...

and remove from drawer_list_item.xml and others attributes "?android:attr/..." that work only with API 14+

This great tutorial by Gabriele Mariotti must help you.

like image 186
aniki.kvn Avatar answered Oct 18 '22 05:10

aniki.kvn