Skip to content
This repository has been archived by the owner. It is now read-only.

ABS causes an InflateException on some devices #446

Closed
ChrisSmith opened this issue Apr 22, 2012 · 54 comments

Comments

@ChrisSmith
Copy link
Contributor

commented Apr 22, 2012

The stacktrace is a few exceptions deep, unfortunately I can't reproduce it locally, this was captured by our app in production. I've pulled out what I think are the most relevant portions.

ABS: 4.0.2
Android: 2.3.5
Devices: M9 and MEIZU MX

java.lang.RuntimeException: Unable to start activity ComponentInfo{my component}: android.view.InflateException: Binary XML file line #24: Error inflating class 
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 #24: Error inflating class 
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
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.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2351)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2406)
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1531)
at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:895)
at com.actionbarsherlock.internal.ActionBarSherlockCompat.initActionBar(ActionBarSherlockCompat.java:137)
at com.actionbarsherlock.internal.ActionBarSherlockCompat.getActionBar(ActionBarSherlockCompat.java:127)
at com.actionbarsherlock.app.SherlockFragmentActivity.getSupportActionBar(SherlockFragmentActivity.java:46)
... 30 more 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.FrameLayout.(FrameLayout.java:88)
at android.widget.FrameLayout.(FrameLayout.java:84)
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)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
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.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2351)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2406)
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1531)
at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:895)
at com.actionbarsherlock.internal.ActionBarSherlockCompat.initActionBar(ActionBarSherlockCompat.java:137)
at com.actionbarsherlock.internal.ActionBarSherlockCompat.getActionBar(ActionBarSherlockCompat.java:127)
at com.actionbarsherlock.app.SherlockFragmentActivity.getSupportActionBar(SherlockFragmentActivity.java:46)
at MyBaseActivity.onCreate(BaseFragmentActivity.java:23)
at MyActivity.onCreate(MyPlaces.java:58)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1046)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1650)
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)

The line it's crashing on (ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:895)

mDecor = (ViewGroup)mActivity.getWindow().getDecorView().findViewById(android.R.id.content);

Inside my app I'm calling getSupportActionBar() before setContentView() and I'm wondering if this is the problem. I just find it odd that it only happens on those two devices and none of my personal devices.

@iNoles

This comment has been minimized.

Copy link

commented Apr 23, 2012

Real error is java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1

It doesn't tell much about the problem. Are you doing dimens.xml?

@ChrisSmith

This comment has been minimized.

Copy link
Contributor Author

commented Apr 23, 2012

For the app yes but nothing todo with the ActionBar. Here's the excerpt from AOSP at android-2.3.5_r1 on View.java

case R.styleable.View_nextFocusRight:
   mNextFocusRightId = a.getResourceId(attr, View.NO_ID);
   break;

It appears they might have modified View.java since the function calls don't line up (the stacktrace shows getDimensionPixelSize, and that function throws the exception when the type isn't TypedValue.TYPE_DIMENSION or TypedValue.TYPE_NULL. Since its 0x1 it could be one of four values docs

Its entirely possible this is a bug in their customized OS.

@willlunniss

This comment has been minimized.

Copy link

commented Apr 23, 2012

Just to add i've seen the same problem with an M9 but not any of the other devices that my users have, it has been on my todo list for a while to investiage.

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented Apr 24, 2012

Definitely a bug. Put a call out for a stock, rooted adb pull of the framework.jar so we can disassemble and take a look.

@SimonVT

This comment has been minimized.

Copy link
Collaborator

commented Apr 24, 2012

@JakeWharton http://simonvt.net/meizu/
These should be from a Meizu M9.. Get to deodex'ing

Edit: Uploaded to my webhost instead
Edit: And packaged: http://dl.dropbox.com/u/100261/framework.zip
Edit: And baksmali'd: http://dl.dropbox.com/u/100261/framework-baksmali.zip
and dex'ed: http://dl.dropbox.com/u/100261/framework.dex

@ChrisSmith

This comment has been minimized.

Copy link
Contributor Author

commented Apr 24, 2012

Interesting I just got the same exception java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1 inside a subclass of PreferenceActivity when calling super.onCreate(savedInstanceState); Except my PreferenceActivity isn't a Sherlock varient and doesn't use the actionbar :/

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented Apr 24, 2012

It's not going to be a View bug. It's probably a bug in TypedArray or the C code that backs its style loading. It looks way beyond ABS.

Thanks for the resources @SimonVT

@iNoles

This comment has been minimized.

Copy link

commented Apr 24, 2012

While I am looking in the View.class, I noticed something like -1 in the 2nd parameter of getDimensionPixelSize

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented Apr 24, 2012

Yeah that's the default which is returned if the value isn't found.

@SimonVT

This comment has been minimized.

Copy link
Collaborator

commented Apr 25, 2012

I tried making a sample project with nothing but ABS and a setContentView. No errors when running on a Meizu M9.

@rffffffff007

This comment has been minimized.

Copy link

commented May 5, 2012

I met the same problem today, i couldn't find the reason but finally got a solution.
It seems that you cannot put any properties that M9 cannot recognize int theme.xml, just like android:actionBarStyle.
So the solution is to make a new theme.xml in value-v14, and put all these properties in it.

@SimonVT

This comment has been minimized.

Copy link
Collaborator

commented May 5, 2012

Really? That's the issue? Goddamn, that's why pure ABS doesn't fuck up then.

@willlunniss

This comment has been minimized.

Copy link

commented May 5, 2012

Do you have a magical list of the properties that it doesn't like? Is it going to be all android prefixed ones that were introduced in and after honeycomb.

@iNoles

This comment has been minimized.

Copy link

commented May 5, 2012

@willlunniss just Android prefix in 3.0+

@ChrisSmith

This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2012

@SimonVT can you confirm placing the android prefixed values in a separate theme.xml file under android-v14 solves this issue?

@SimonVT

This comment has been minimized.

Copy link
Collaborator

commented May 7, 2012

@ChrisSmith Yep, it's confirmed.

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented May 7, 2012

Well, that's annoying! But it's a good practice despite being cumbersome. Now I have to debate whether or not to recommend people do this...

@ChrisSmith

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2012

It at least warrants a note in the documentation under theming, because if you don't then your app won't even open for some users. Hopefully its just these two devices but there could be more.

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented May 7, 2012

Are they CDD devices? They have the Play Store?


Jake Wharton
http://about.me/jakewharton

On Sun, May 6, 2012 at 10:07 PM, ChrisSmith <
reply@reply.github.com

wrote:

It at least warrants a note in the documentation under theming, because if
you don't then your app won't even open for some users. Hopefully its just
these two devices but there could be more.


Reply to this email directly or view it on GitHub:

#446 (comment)

@SimonVT

This comment has been minimized.

Copy link
Collaborator

commented May 7, 2012

Apparently they didn't launch with market, but got it with a later update. I kinda doubt they bothered much with the CDD.

@SimonVT

This comment has been minimized.

Copy link
Collaborator

commented May 7, 2012

As far as I can tell, this only seems to apply for the theme, not any styles referenced in either the theme or on a View directly (I use a few newer attributes in my styles, and the guy with a Meizu M9 says everything works perfectly). That's something, at least.

@JakeWharton As @ChrisSmith said, put this in the documentation. You said it yourself, it's good practice, and fixes issues like this on broken devices.

@RacZo

This comment has been minimized.

Copy link

commented May 16, 2012

Hey guys! Awesome job with the ABS!

I started using it 1 week ago, everyhting went smoothly implementing it in my HomeActivity (a SherlockFragmentActivity with 5 Tabs, each tab with either an SherlockListFragment or a custom SherlockExpandableListFragment I made... well, there the ActionBar from ABSv4 works great with different Menus for each Tab)... But, (there's always a but...) by 3 days an error that happens when I start a SherlockActivity by tapping on one of my HomeActivity's List items its been driving me crazy, I've googled it, stackoverflowed it, and the closest topic I've found is this post here in GitHub.

Could you please explain a little bit more how did you solved it, if there's a solution? What did you meant up there, by saying that copying the "android" prefixed values to a separate theme.xml on the values-v14 helped it?

Well this is the error that's driving me nuts:

05-16 11:10:43.164: E/AndroidRuntime(3636): FATAL EXCEPTION: main
05-16 11:10:43.164: E/AndroidRuntime(3636): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.realactionsoft.android.worldcupflags./com.realactionsoft.android.worldcupflags.FlagsSherlockActivity}: android.view.InflateException: Binary XML file line #31: Error inflating class
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.os.Looper.loop(Looper.java:123)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-16 11:10:43.164: E/AndroidRuntime(3636): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 11:10:43.164: E/AndroidRuntime(3636): at java.lang.reflect.Method.invoke(Method.java:521)
05-16 11:10:43.164: E/AndroidRuntime(3636): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-16 11:10:43.164: E/AndroidRuntime(3636): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-16 11:10:43.164: E/AndroidRuntime(3636): at dalvik.system.NativeStart.main(Native Method)
05-16 11:10:43.164: E/AndroidRuntime(3636): Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-16 11:10:43.164: E/AndroidRuntime(3636): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1042)
05-16 11:10:43.164: E/AndroidRuntime(3636): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:912)
05-16 11:10:43.164: E/AndroidRuntime(3636): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:846)
05-16 11:10:43.164: E/AndroidRuntime(3636): at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:212)
05-16 11:10:43.164: E/AndroidRuntime(3636): at com.realactionsoft.android.worldcupflags.FlagsSherlockActivity.onCreate(FlagsSherlockActivity.java:418)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-16 11:10:43.164: E/AndroidRuntime(3636): ... 11 more
05-16 11:10:43.164: E/AndroidRuntime(3636): Caused by: java.lang.reflect.InvocationTargetException
05-16 11:10:43.164: E/AndroidRuntime(3636): at com.actionbarsherlock.internal.widget.ActionBarView.(ActionBarView.java:195)
05-16 11:10:43.164: E/AndroidRuntime(3636): at java.lang.reflect.Constructor.constructNative(Native Method)
05-16 11:10:43.164: E/AndroidRuntime(3636): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-16 11:10:43.164: E/AndroidRuntime(3636): ... 24 more
05-16 11:10:43.164: E/AndroidRuntime(3636): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f02015c
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.content.res.Resources.getValue(Resources.java:892)
05-16 11:10:43.164: E/AndroidRuntime(3636): at android.content.res.Resources.getDrawable(Resources.java:580)
05-16 11:10:43.164: E/AndroidRuntime(3636): ... 28 more

Oh, I forgot to mention that it happens exactly on the activitiy's onCreate, just at setContentView(R.layout.flags) and that flags.xml contains a ScrollView and a couple of includes. It also happens if I want to start a SherlockFragmentExpandableListActivity.

I have the styles.xml with custom styles I created for UI components of my App and I have theme.xml file with only the Theme.AndroidDevelopers with parent="@style/Theme.Sherlock.Light" wich is applied at the Manifest to all the App, the Widget.Styled.ActionBar style is also at the theme.xml file.

Thanks, and cheers!

@iNoles

This comment has been minimized.

Copy link

commented May 16, 2012

@RacZo Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f02015c

I think you should do full clean on like bin and gen.

@RacZo

This comment has been minimized.

Copy link

commented May 16, 2012

Thanks for your help, but nope! I deleted all from bin and gen, recompiled the whole project and still have the same errors when launching either a class that extends SherlockFragmentActivity or SherlockExpandableListActivity. Should I clean the com_actionbarsherlock library project wich is among my project's dependencies too?

@RacZo

This comment has been minimized.

Copy link

commented May 16, 2012

Actually, that resource id corresponds to public static final int title_logo=0x7f02015c; at the com.actionbarsherlock.R class in my project's gen folder and I think it's been always there... I guess, for some reason my App is trying to find it in my project's R class.

@RacZo

This comment has been minimized.

Copy link

commented May 16, 2012

@iNoles thanks again for your interest in helping me. I have cleaned it for nth time and the error has "mutated", so probably a full clean was needed, but now my app crashes since the first reference to ActionBar in the onCreate method of the HomeActivity (a SherlockFragmentActivity), here's the error and it's another InflateException:

05-16 16:49:29.713: E/AndroidRuntime(1193): FATAL EXCEPTION: main
05-16 16:49:29.713: E/AndroidRuntime(1193): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.realactionsoft.android.worldcupflags/com.realactionsoft.android.worldcupflags.HomeActivity}: android.view.InflateException: Binary XML file line #31: Error inflating class com.actionbarsherlock.internal.widget.ActionBarView
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.os.Looper.loop(Looper.java:123)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-16 16:49:29.713: E/AndroidRuntime(1193): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 16:49:29.713: E/AndroidRuntime(1193): at java.lang.reflect.Method.invoke(Method.java:521)
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-16 16:49:29.713: E/AndroidRuntime(1193): at dalvik.system.NativeStart.main(Native Method)
05-16 16:49:29.713: E/AndroidRuntime(1193): Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class com.actionbarsherlock.internal.widget.ActionBarView
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1042)
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:912)
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.actionbarsherlock.internal.ActionBarSherlockCompat.initActionBar(ActionBarSherlockCompat.java:137)
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.actionbarsherlock.internal.ActionBarSherlockCompat.getActionBar(ActionBarSherlockCompat.java:127)
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.actionbarsherlock.app.SherlockFragmentActivity.getSupportActionBar(SherlockFragmentActivity.java:46)
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.realactionsoft.android.worldcupflags.HomeActivity.onCreate(HomeActivity.java:231)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-16 16:49:29.713: E/AndroidRuntime(1193): ... 11 more
05-16 16:49:29.713: E/AndroidRuntime(1193): Caused by: java.lang.reflect.InvocationTargetException
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.actionbarsherlock.internal.widget.ActionBarView.(ActionBarView.java:235)
05-16 16:49:29.713: E/AndroidRuntime(1193): at java.lang.reflect.Constructor.constructNative(Native Method)
05-16 16:49:29.713: E/AndroidRuntime(1193): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-16 16:49:29.713: E/AndroidRuntime(1193): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-16 16:49:29.713: E/AndroidRuntime(1193): ... 25 more
05-16 16:49:29.713: E/AndroidRuntime(1193): Caused by: java.lang.NullPointerException
05-16 16:49:29.713: E/AndroidRuntime(1193): at com.actionbarsherlock.internal.widget.ActionBarView$HomeView.setUp(ActionBarView.java:1302)
05-16 16:49:29.713: E/AndroidRuntime(1193): ... 29 more

:(

@iNoles

This comment has been minimized.

Copy link

commented May 17, 2012

Caused by: java.lang.NullPointerException at com.actionbarsherlock.internal.widget.ActionBarView$HomeView.setUp(ActionBarView.java:1302)

I wondering why that line is NULL

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented May 17, 2012

That crash usually indicates a stale R.java file. Clean the project or rm -rf bin gen.

@RacZo

This comment has been minimized.

Copy link

commented May 17, 2012

Thanks @JakeWharton!

Well.. rm -rf bin and rm- rf gen did fixed my HomeActivity, the App launches again, beautifully with it's tabs and list fragments. But, again I'm back to the original issue, when I tap a list item to go to a separate SherlockFragmentActivity, boom! This happens:

05-16 21:38:35.792: E/AndroidRuntime(788): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.realactionsoft.android.worldcupflags./com.realactionsoft.android.worldcupflags.FlagsSherlockActivity}: android.view.InflateException: Binary XML file line #31: Error inflating class
05-16 21:38:35.792: E/AndroidRuntime(788): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.os.Looper.loop(Looper.java:123)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-16 21:38:35.792: E/AndroidRuntime(788): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 21:38:35.792: E/AndroidRuntime(788): at java.lang.reflect.Method.invoke(Method.java:521)
05-16 21:38:35.792: E/AndroidRuntime(788): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-16 21:38:35.792: E/AndroidRuntime(788): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-16 21:38:35.792: E/AndroidRuntime(788): at dalvik.system.NativeStart.main(Native Method)
05-16 21:38:35.792: E/AndroidRuntime(788): Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class
05-16 21:38:35.792: E/AndroidRuntime(788): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-16 21:38:35.792: E/AndroidRuntime(788): at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1042)
05-16 21:38:35.792: E/AndroidRuntime(788): at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:912)
05-16 21:38:35.792: E/AndroidRuntime(788): at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:846)
05-16 21:38:35.792: E/AndroidRuntime(788): at com.actionbarsherlock.app.SherlockExpandableListActivity.setContentView(SherlockExpandableListActivity.java:212)
05-16 21:38:35.792: E/AndroidRuntime(788): at com.realactionsoft.android.worldcupflags.FlagsSherlockActivity.onCreate(PlaceCatalog.java:898)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-16 21:38:35.792: E/AndroidRuntime(788): ... 11 more
05-16 21:38:35.792: E/AndroidRuntime(788): Caused by: java.lang.reflect.InvocationTargetException
05-16 21:38:35.792: E/AndroidRuntime(788): at com.actionbarsherlock.internal.widget.ActionBarView.(ActionBarView.java:195)
05-16 21:38:35.792: E/AndroidRuntime(788): at java.lang.reflect.Constructor.constructNative(Native Method)
05-16 21:38:35.792: E/AndroidRuntime(788): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-16 21:38:35.792: E/AndroidRuntime(788): ... 24 more
05-16 21:38:35.792: E/AndroidRuntime(788): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020155
05-16 21:38:35.792: E/AndroidRuntime(788): at android.content.res.Resources.getValue(Resources.java:892)
05-16 21:38:35.792: E/AndroidRuntime(788): at android.content.res.Resources.getDrawable(Resources.java:580)
05-16 21:38:35.792: E/AndroidRuntime(788): ... 28 more

On the tablet emulator everything works fine.

But on the handset, I have a black gap between the ActionBar and the TabHost with the tabs and its content, that does not happen in the tablet tho. I guess if it is related to the blue colorstrip present on ICS what goes in that black gap?

My handset emulator is API Level 8 (Android 2.2), and my tablet emulator is API Level 11 (Android 3.0).

On a simulator for an ICS handset API Level 15 obviously everything works, I assume it also works on an API Level 14, because is ICS.

Do I have to specify styles for the ActionBar or other things like attrs or drawables for every version under 14 or something?

After removing the gen and bin folders several times, I see the problem has become kinda cyclic, when the HomeActivity does launches, the other activities won't... the next time I remove the folders and rebuild the HomeActivity will crash.

I'll get the App on a couple of real phones tomorrow to test, but this is really discouraging, I really want to use Action Bar Sherlock to support ActionBar compatibility across all versions of Android from 8 (because I will use C2DM) to 15, but with this issues, I don't know what to do... :S

Thanks for your help guys!

@Sleepybear

This comment has been minimized.

Copy link

commented May 17, 2012

Do you have to have your Tabs as SherlockFragmentActivities ? Would regular Fragments not suffice?

@RacZo

This comment has been minimized.

Copy link

commented May 17, 2012

Hey @Sleepybear, my tabs are Fragments, sorry if there's a misunderstanding on my last posts. But if you read the original post, I mentioned there that I could navigate trough all the tabs wich are either SherlockListFragment or custom SherlockExpandableListFragment withouth problems, but when I click on an item of such lists and I want to go to a SherlockActivity let's say the Detail of the clicked item, it crashes.

After cleaning and deleting bin and gen folders I came to the second issue where the HomeActivity would crash making the app not to launch at all. If its not one thing, is the other.

I have reviewed the Manifest 100s times and it seems ok, the themes.xml seems ok and it does not have modifications, and my custom styles are in a styles.xml file, the Classes are inheriting from what they are supposed to, the proguard.cfg has the lines it must have, the samples using ABS4 are running ok in the emulators and I can build them with Eclipse without issues... I don't know what else to check?

Cool nickname btw! xD

@iNoles

This comment has been minimized.

Copy link

commented May 17, 2012

@RacZo some times, I wish I see your source code so I may pinpoint problems.

@Sleepybear

This comment has been minimized.

Copy link

commented May 17, 2012

How about instead of hijacking a github issue you either start a post on the google group at
https://groups.google.com/forum/?fromgroups#!forum/actionbarsherlock or hop on Freenode IRC and join #actionbarsherlock

@RacZo

This comment has been minimized.

Copy link

commented May 17, 2012

@iNoles, I would like to share the code but it does not depend entirely on me. @Sleepybear I went to that forum before lading here, but did not found any similar thing, I'm already a member tho ;)

Well sorry if I hijacked this github issue... at this point, I can't dig more on this... I have to meet some deadlines. I'll just resume implementing ABS later.

@bvirlet

This comment has been minimized.

Copy link

commented May 21, 2012

Regarding the original issue, what is the appropriate fix?

For instance if I have the following in my styles.xml

    <item name="android:actionBarDivider">@drawable/divider</item>
    <item name="actionBarDivider">@drawable/divider</item>

Should I move the first line in the values-v14 folder?

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented May 21, 2012

Yes. Anything in the theme related to the action bar and any action bar or action mode style should be in values-v14/ with the android prefix. Everything non-Android prefixed should be in values/ (along with the regular old theme stuff).

@bvirlet

This comment has been minimized.

Copy link

commented May 21, 2012

Ok, thanks Jake!

@bvirlet

This comment has been minimized.

Copy link

commented Jun 4, 2012

Hey Jake,

Still having the issue: should I also move to -v14 styles like the following:

<style name="MyActionBarTabBarStyle" parent="Widget.Sherlock.ActionBar.TabBar">
    <item name="android:showDividers">middle</item>
<item name="android:dividerPadding">0dp</item>
<item name="android:textAllCaps">false</item>
    <item name="android:divider">@drawable/divider</item>
</style>
@janders-evernote

This comment has been minimized.

Copy link

commented Jun 8, 2012

Thank you so much for posting about this! It would have taken me forever to figure this one out. Just released a new app and started seeing this, and was able to have a fix in a day thanks to you.

@beartung

This comment has been minimized.

Copy link

commented Jul 12, 2012

@JakeWharton

in my values/themes.xml

<style name="Theme.Styled" parent="Theme.Sherlock.Light">
    <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid">
    <item name="indeterminateProgressStyle">@style/IndeterminateProgress</item>
    <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item>
    <item name="android:background">#d5f4eb</item>
    <item name="background">#d5f4eb</item>
</style>

i move this file to values-v14 but still not work in meizu. and if i do this, other 2.x android will not find the themes
can you give a demo or some details ?

thanks a lot!

@beartung

This comment has been minimized.

Copy link

commented Jul 12, 2012

and device is meizu m9 with 2.3.7

@beartung

This comment has been minimized.

Copy link

commented Jul 12, 2012

ok, it's works!

@marcardar

This comment has been minimized.

Copy link

commented Sep 16, 2012

Is it OK to put the "android:" attrs in values-v11 instead of values-v14? The two relevant attrs I use in my themes were both introduced in v11...

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented Sep 16, 2012

If you want. They still won't be read except on API 14 and up.

@marcardar

This comment has been minimized.

Copy link

commented Sep 16, 2012

Ok, thanks. Though I suppose they (android:actionBarStyle & android:indeterminateProgressStyle) could be used elsewhere.

Out of interest, a style defined in -v11 with parent="@style/Theme.Sherlock.Light", would that parent be picked up from ABS's -v11 or -v14 style on a level 14 device?

@JakeWharton

This comment has been minimized.

Copy link
Owner

commented Sep 16, 2012

It will pick up the on in values-v14/.

@dingzhihu

This comment has been minimized.

Copy link

commented Sep 21, 2012

hey,the issue made me nut. have u solved the problem?can u give a quick solution? or it is a ROM bug? many thanks

@SimonVT

This comment has been minimized.

Copy link
Collaborator

commented Sep 21, 2012

It's a rom issue. The solution is, as mentioned, to put android: prefixed attributes in values-v14.

@dingzhihu

This comment has been minimized.

Copy link

commented Sep 21, 2012

@SimonVT you mean i have to put all attrs prefixed with android: into values-v14? many thanks.

@app2go

This comment has been minimized.

Copy link

commented Dec 11, 2012

I just ran into that issue on a Kindle Fire 1st Generation.
Strange about my case was that the exception was only thrown after I introduced a style for a MultiAutoCompleteTextView with android:autoCompleteTextViewStyle.
I used android:actionBarStyle and android:actionModeCloseDrawable in my theme without problems. Only after the MultiAutoCompleteTextView style was added did it crash with the mentioned exception.
Putting the two "android:" attrs in values-v11 did solve the problem.
Just wanted to let you know in case someone else runs into that issue.

@pratikbutani

This comment has been minimized.

Copy link

commented Sep 12, 2013

My Question is http://stackoverflow.com/q/18741485/1318946

I am getting error in layout file, i have used custom actionbar theme but which file i have to put values-v11 or values-v14, i didn't get

Please Help me....

Thanks in advance...

@iNoles

This comment has been minimized.

Copy link

commented Sep 12, 2013

@pratikbutani You have to split your custom theme's styes.xml into two files. On styles.xml, anything is related for action bar and action mode with android prefix, it need to be on values-v14.

@pratikbutani

This comment has been minimized.

Copy link

commented Sep 13, 2013

@iNoles So in values-v11 we don't need to android prefix?

i have files like:


in values folder

->styles_apptheme.xml
http://pastebin.com/SbgZMyJk

->styles_myactionbar.xml
http://pastebin.com/ch3j5T2Y

->styles.xml
http://pastebin.com/aMwbanza


In values-v11 folder

->styles_apptheme.xml
http://pastebin.com/Jw2vdQ3G

->styles.xml
http://pastebin.com/CAdrJCN5


In values-v14 folder
->styles_myactionbar.xml
http://pastebin.com/qr8WzHC4

->styles.xml
http://pastebin.com/ATYssBut


In AndroidManifest.xml i have applied theme like

android:theme="@style/Theme.Myactionbar"

So now what can i do. i dont understand whats going wrong?

Please help me...

thanks in advance...

illugerrit pushed a commit to IllusionRom-deprecated/android_platform_sdk that referenced this issue Dec 19, 2013
Api Detector: Flag style definitions. DO NOT MERGE
This should help track down problems like
JakeWharton/ActionBarSherlock#446

Change-Id: I1f00a69637a7c59bedf197b559a95b7b0ea81f7f
zeldin pushed a commit to zeldin/platform_tools_base that referenced this issue Feb 5, 2014
Api Detector: Flag style definitions
This should help track down problems like
JakeWharton/ActionBarSherlock#446

Change-Id: I50b6fb8842cf42aadabd3b4c4a364e5e664d5599
@pratikbutani

This comment has been minimized.

Copy link

commented Sep 30, 2014

Finally I got solution that you can find here: http://stackoverflow.com/a/18844713/1318946

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
You can’t perform that action at this time.