johannilsson / android-actionbar

DEPRECATED Android Action Bar Implementation
1.31k stars 564 forks source link

Failed to inflate with mimic-native-api #46

Closed rekisum closed 12 years ago

rekisum commented 12 years ago

Hi, the example application crashes with Failed to inflate!

01-04 14:52:33.769: E/ActivityThread(2127): android.view.InflateException: Binary XML file line #7: Error inflating class com.markupartist.android.widget.ActionBar

I tried to run it on an Touchpad with Android 2.3.7 but had to compile for Android 4.0.

When trying to use actionbar in my project I also get errors like: Couldn't resolve resource @style/ActionBar You must supply a layout_width attribute.

Maybe I done something wrong?

johannilsson commented 12 years ago

You're using the mimic branch? Will look at it tonight, I might not have updated the example project properly yet. But check that you've added the correct theme or referencing the style attr in your custom theme. This project is using the latest version of the mimic branch https://github.com/johannilsson/sthlmtraveling/blob/master/res/values/styles.xml.

Edit: Just noticed your title that it's the mimic branch, sorry :)

rekisum commented 12 years ago

Thanks for your quick reply! I am using the latest version, cloned two hours ago. Do I need to add the android support librarys to the project? So far I was only dealing with 2.3 API ...

johannilsson commented 12 years ago

You don't need the support library, but you need to use the latest sdk 14+. The styles used by the actionbar extends from Android themes (this will change later on), currently a theme from api level 14 is used within styles (will probably rework that tonight) but you can workaround this by adding a separate values directory for api level 14. See the res directory in the above referenced project for an example of that.

johannilsson commented 12 years ago

However, the library runs fine on 1.6+. You just need a later sdk at build time.

rekisum commented 12 years ago

I'm using Android 4.0.3 API 15 for building because you use the Holo theme and ActionProvider class

Ok, and the latter pointed me to set sdk to 14 in the manifest.xml I used them as they were in your repository.

Now the example runs! I'll try to get it work in my app now. I switched to mimic because I wanted to change icons dynamically?

rekisum commented 12 years ago

Had to change targetsdk to 14 or greater. Thanks!

johannilsson commented 12 years ago

Great, thanks for the update. Will fix the sample soonish.

johannilsson commented 12 years ago

Should hopefully work better now with, 9ceef7f35ca0533e4a3b688ea4ce00dc28bf228f

rfgamaral commented 12 years ago

I think you're missing a values-v11 too, not exactly to fix the issue reported here but to make the theme more consistent in all versions, take a look at this: http://www.chainfire.eu/articles/109/Themes_across_Android_versions/