I\'m trying to upgrade my app from API19 to API21
The main changes I\'ve made to the gradle properties are:
compileSdkVersion 21
buildToolsVersion \"
For me the issue seemed to be in layout files when using the ?attr/ format for values. I'm not sure if it's theme related. I took all these out to get things going and then added styles back in.
I had similar issue, i'm using AppCompat.v21 and supporting Android 5.0.
My layout uses the ?attr/[attribute_name] for some values and I use the activity context.
I changed it to ?android:attr/[attribute_name] and now my views inflate just fine on devices running Android 5.0.
I had the same problem when trying to use ?attr/selectableItemBackground
and based on your answer and some digging around on the internet I found out what was wrong for me (and probably you as well).
From this answer I learned that "? mark is used to reference style in current theme." Which means that when you use ?attr/ you refer to something in the current theme.
I noticed that I got this crash only when inflating using the application context and not when using the activity context. This blog post explains what's happening in "Context Capabilities" section.
...[When using the application context] inflation will be done with the default theme for the system on which you are running, not what’s defined in your application.
This mean that ?attr/ won't work since they refer to the current theme, not the default system theme you're inflating with.
So ?attr/ works fine if you make sure to inflate using the Activity context instead of the application context.
style name="AppTheme" parent="Base.V23.Theme.AppCompat" in style.xml worked for my app.