Material 设计 build.gradle 错误

Material Design build.gradle error

我的 build.gradle 文件有问题,compileSdkVersionbuildToolsVersion 不匹配。

这是我的build.gradle:

    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 22
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "com.emergencyapp"
        minSdkVersion 18
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        preDexLibraries = false
    }
    }

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.jakewharton:butterknife:6.1.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    }

这是我的错误:

我认为是 buildToolsVersion 并且依赖项导致了问题。

请设置targetSdkVersion 23和依赖项

我遇到了同样的问题,我做的是

  1. 首先确保您已安装 API 级别 23(棉花糖/ android 6)。
  2. compileSdkVersion 设置为 23,依赖库也设置为大于 23。
  3. 清理并构建项目。

Since you are using version 23 of the SupportLibrary, you need to compile against version 23 of the Android SDK.

只需将您的编译 sdk 更改为 23Google:

已经给出了答案

https://code.google.com/p/android/issues/detail?id=183149

compileSdkVersion 23

因为您正在使用

compile 'com.google.android.gms:play-services:8.4.0'

您与支持库 v.23 有依赖关系,如果您声明 v22.
这意味着您必须使用 api 23.

进行编译

只需使用:

compileSdkVersion 23

否则使用旧版本com.google.android.gms:play-services