找不到android.support.design.CoordinatorLayout类

时间:2015-08-27 11:42:53

标签: android android-5.0-lollipop

在整合新设计库时我遇到了以下崩溃,但还没有找到解决方法:

错误导致类android.support.design.CoordinatorLayout错误

这是我的gradle文件:

android {
compileSdkVersion 23
buildToolsVersion "23.0.0"

defaultConfig {
    applicationId "xxxxxxxx"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':volley')
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
}

...和应用程序样式:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->

    <item name="android:colorPrimary">@color/primary</item>
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
    <item name="android:colorAccent">@color/accent</item>
    <item name="android:colorBackground">@android:color/white</item>
    <item name="android:windowBackground">@android:color/white</item>

    <item name="android:colorControlNormal">#cccccc</item>
</style>

public class TabbedScreenActivity extends AppCompatActivity

2 个答案:

答案 0 :(得分:5)

它位于android.support.design.widget包中。膨胀android.support.design.widget.CoordinatorLayout

答案 1 :(得分:0)

上面的答案是正确的,也确保你有与buildtoolsversion匹配的依赖项

compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'

我这样做了,它对我有用..