Error when adding CardView to layout

try adding this line to your RelativeLayout

xmlns:card_view="http://schemas.android.com/apk/res-auto"

It solved me by adding xmlns:card_view="http://schemas.android.com/apk/res-auto"

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            xmlns:card_view="http://schemas.android.com/apk/res-auto"> --->> ******
        ....
        ...
        <android.support.v7.widget.CardView>
    ..
...
.....

        </android.support.v7.widget.CardView>
        </LinearLayout>

I was able to get it to work on the emulator by changing my build.gradle to this:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:cardview-v7:+'
}

Make sure you have the support repository installed from the SDK Manager! Hope this helps

EDIT: as someone suggested using 'com.android.support:cardview-v7:23.1' is a better practice but it not required.