ActionBarSherlock layout inflating error-Collection of common programming errors
I have a strange problem on a dialog fragment using ActionBarSherlock at this line in onCreateView
LinearLayout root = (LinearLayout) inflater.inflate(com.example.R.layout.new_event_dialog_fragment, container, false);
this is my ActionBarSherlock project manifest :
and this my application target:
running my app on emulator with api level 10 i got this error:
892: E/AndroidRuntime(645): FATAL EXCEPTION: main
09-12 10:00:38.892: E/AndroidRuntime(645): android.view.InflateException: Binary XML file line #26: Error inflating class android.view.View
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
09-12 10:00:38.892: E/AndroidRuntime(645): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-12 10:00:38.892: E/AndroidRuntime(645): at com.example.gui.fragment.dialog.NewEventDialogFragment.onCreateView(NewEventDialogFragment.java:34)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:420)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.os.Handler.handleCallback(Handler.java:587)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.os.Handler.dispatchMessage(Handler.java:92)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.os.Looper.loop(Looper.java:123)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-12 10:00:38.892: E/AndroidRuntime(645): at java.lang.reflect.Method.invokeNative(Native Method)
09-12 10:00:38.892: E/AndroidRuntime(645): at java.lang.reflect.Method.invoke(Method.java:507)
09-12 10:00:38.892: E/AndroidRuntime(645): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-12 10:00:38.892: E/AndroidRuntime(645): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-12 10:00:38.892: E/AndroidRuntime(645): at dalvik.system.NativeStart.main(Native Method)
09-12 10:00:38.892: E/AndroidRuntime(645): Caused by: java.lang.reflect.InvocationTargetException
09-12 10:00:38.892: E/AndroidRuntime(645): at java.lang.reflect.Constructor.constructNative(Native Method)
09-12 10:00:38.892: E/AndroidRuntime(645): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
09-12 10:00:38.892: E/AndroidRuntime(645): ... 21 more
09-12 10:00:38.892: E/AndroidRuntime(645): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x101030a a=-1}
09-12 10:00:38.892: E/AndroidRuntime(645): at android.content.res.Resources.loadDrawable(Resources.java:1681)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.View.(View.java:1951)
09-12 10:00:38.892: E/AndroidRuntime(645): at android.view.View.(View.java:1899)
09-12 10:00:38.892: E/AndroidRuntime(645): ... 24 more
If i run on emulator with api level 7 i got this different error:
09-12 10:15:02.035: E/AndroidRuntime(220): Uncaught h
Handler: thread main exiting due to uncaught exception
09-12 10:15:02.067: E/AndroidRuntime(220): android.view.InflateException: Binary XML file line #26: Error inflating class android.view.View
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
09-12 10:15:02.067: E/AndroidRuntime(220): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-12 10:15:02.067: E/AndroidRuntime(220): at com.example.gui.fragment.dialog.NewEventDialogFragment.onCreateView(NewEventDialogFragment.java:34)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:420)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.os.Handler.handleCallback(Handler.java:587)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.os.Handler.dispatchMessage(Handler.java:92)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.os.Looper.loop(Looper.java:123)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.app.ActivityThread.main(ActivityThread.java:4363)
09-12 10:15:02.067: E/AndroidRuntime(220): at java.lang.reflect.Method.invokeNative(Native Method)
09-12 10:15:02.067: E/AndroidRuntime(220): at java.lang.reflect.Method.invoke(Method.java:521)
09-12 10:15:02.067: E/AndroidRuntime(220): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-12 10:15:02.067: E/AndroidRuntime(220): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-12 10:15:02.067: E/AndroidRuntime(220): at dalvik.system.NativeStart.main(Native Method)
09-12 10:15:02.067: E/AndroidRuntime(220): Caused by: java.lang.reflect.InvocationTargetException
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.View.(View.java:1799)
09-12 10:15:02.067: E/AndroidRuntime(220): at java.lang.reflect.Constructor.constructNative(Native Method)
09-12 10:15:02.067: E/AndroidRuntime(220): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
09-12 10:15:02.067: E/AndroidRuntime(220): ... 21 more
09-12 10:15:02.067: E/AndroidRuntime(220): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/btn_dropdown.xml from drawable resource ID #0x0
09-12 10:15:02.067: E/AndroidRuntime(220): at android.content.res.Resources.loadDrawable(Resources.java:1693)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.view.View.(View.java:1850)
09-12 10:15:02.067: E/AndroidRuntime(220): ... 25 more
09-12 10:15:02.067: E/AndroidRuntime(220): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/btn_dropdown.xml from xml type drawable resource ID #0x0
09-12 10:15:02.067: E/AndroidRuntime(220): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1920)
09-12 10:15:02.067: E/AndroidRuntime(220): at android.content.res.Resources.loadDrawable(Resources.java:1688)
09-12 10:15:02.067: E/AndroidRuntime(220): ... 27 more
My layout
It seems to be a resource error (i think about spinner’s res) in both cases but i can’t resolve. I try changing api target, full clean.. but nothing. Thanks
PS: running on my real device (4.0.4) or on emulator (4.1.1) all works fine