Error when using any Android Design Support Library Elements

In addition to Emmanuel’s answer you could be facing the following problem.

It seems like the design library components need a style which is based on an AppCompat Theme. So try to use “Theme.AppCompat.[…]” as a parent in your style.xml.

Example:

<!-- Base application theme. -->
<style name="AppTheme" parent="Base.AppTheme">
    <!-- Customize your theme here. -->
</style>

<style name="Base.AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:colorPrimary">@color/primary</item>
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
    <item name="android:colorAccent">@color/accent</item>
</style>

Then add the following to your build.gradle as well:

compile 'com.android.support:appcompat-v7:22.2.0'

Additionally you should update the following lines in your gradle as well:

classpath 'com.android.tools.build:gradle:1.2.3'
compileSdkVersion 22
buildToolsVersion '22.0.1'
targetSdkVersion 22

Leave a Comment