Didn't find class "android.support.v7.widget.CardView" on path: DexPathList[[zip file "/data/app/com

Didn't find class "android.support.v7.widget.CardView" on path: DexPathList[[zip file "/data/app/com.example.administrator.myapplication-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.administrator.myapplication/com.example.administrator.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class android.support.v7.widget.CardView

出现这个问题是由于,Android系统找不到CardView这个类。

解决方法:

在build.gradle中添加如下代码:

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

接着Build -->Clean project。

Didn't find class

你可能感兴趣的:(Android5.0)