Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

actionBarItemBackground; Resource is not a Drawable #222

Closed
astachowiak opened this issue Feb 7, 2012 · 6 comments
Closed

actionBarItemBackground; Resource is not a Drawable #222

astachowiak opened this issue Feb 7, 2012 · 6 comments
Milestone

Comments

@astachowiak
Copy link

On HTC Desire running ICS 4.0.3 when in the demos (version 4.0.0 beta #5) one replaces the base activity of SampleList from ListActivity to SherlockListActivity application crashes with the following log:

02-07 16:55:40.877: E/AndroidRuntime(7146): FATAL EXCEPTION: main
02-07 16:55:40.877: E/AndroidRuntime(7146): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.actionbarsherlock.sample.demos/com.actionbarsherlock.sample.demos.SampleList}: android.view.InflateException: Binary XML file line #31: Error inflating class com.actionbarsherlock.internal.widget.ActionBarView
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.os.Looper.loop(Looper.java:137)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.ActivityThread.main(ActivityThread.java:4424)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at java.lang.reflect.Method.invokeNative(Native Method)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at java.lang.reflect.Method.invoke(Method.java:511)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at dalvik.system.NativeStart.main(Native Method)
02-07 16:55:40.877: E/AndroidRuntime(7146): Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class com.actionbarsherlock.internal.widget.ActionBarView
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.actionbarsherlock.ActionBarSherlock.generateLayout(ActionBarSherlock.java:1021)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.actionbarsherlock.ActionBarSherlock.installDecor(ActionBarSherlock.java:854)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.actionbarsherlock.ActionBarSherlock.setContentView(ActionBarSherlock.java:779)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.actionbarsherlock.app.SherlockListActivity.setContentView(SherlockListActivity.java:206)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.ListActivity.ensureList(ListActivity.java:312)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.ListActivity.setListAdapter(ListActivity.java:263)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.actionbarsherlock.sample.demos.SampleList.onCreate(SampleList.java:50)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.Activity.performCreate(Activity.java:4465)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
02-07 16:55:40.877: E/AndroidRuntime(7146):     ... 11 more
02-07 16:55:40.877: E/AndroidRuntime(7146): Caused by: java.lang.reflect.InvocationTargetException
02-07 16:55:40.877: E/AndroidRuntime(7146):     at java.lang.reflect.Constructor.constructNative(Native Method)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
02-07 16:55:40.877: E/AndroidRuntime(7146):     ... 27 more
02-07 16:55:40.877: E/AndroidRuntime(7146): Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class com.actionbarsherlock.internal.widget.ActionBarView$HomeView
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.actionbarsherlock.internal.widget.ActionBarView.<init>(ActionBarView.java:232)
02-07 16:55:40.877: E/AndroidRuntime(7146):     ... 30 more
02-07 16:55:40.877: E/AndroidRuntime(7146): Caused by: java.lang.reflect.InvocationTargetException
02-07 16:55:40.877: E/AndroidRuntime(7146):     at java.lang.reflect.Constructor.constructNative(Native Method)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
02-07 16:55:40.877: E/AndroidRuntime(7146):     ... 34 more
02-07 16:55:40.877: E/AndroidRuntime(7146): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01000f a=-1}
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.content.res.Resources.loadDrawable(Resources.java:1899)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.View.<init>(View.java:2785)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.view.ViewGroup.<init>(ViewGroup.java:385)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.widget.FrameLayout.<init>(FrameLayout.java:99)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at android.widget.FrameLayout.<init>(FrameLayout.java:95)
02-07 16:55:40.877: E/AndroidRuntime(7146):     at com.actionbarsherloc
@JakeWharton
Copy link
Owner

You have to use Theme.Sherlock or Theme.Sherlock.Light as your theme.

@JakeWharton
Copy link
Owner

Lets turn this issue into 'Fail gracefully if missing theme' :)

@JakeWharton
Copy link
Owner

So there's no easy way to support this so I settled for providing a more informative error message.

02-07 22:52:03.063: E/AndroidRuntime(5249): Caused by: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.

@astachowiak
Copy link
Author

Thank you. That is sufficient to be able to figure out what is missing.

@ileafdeveloper
Copy link

@astachowiak how you resolve this issue? . I am facing same issue.

@tprochazka
Copy link

I have the same problem with this style

<style name="AppTheme.Translucent" parent="@android:style/Theme.Translucent.NoTitleBar">
    <item name="android:windowActionBar">false</item>
    <item name="windowActionBar">false</item>
</style>

I think that if I use windowActionBar false, actionbar should not initialize. This work in ICS, but on on 2.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants