无法在额外的属性扩展上获取属性'compileSdkVersion',因为它不存在

时间:2016-04-10 12:30:09

标签: android

有人请帮助我...... 无法在额外的属性扩展上获取属性'compileSdkVersion',因为它在android studio中不存在。

2 个答案:

答案 0 :(得分:1)

转到“项目文件”视图,然后打开构建gradle。

你会发现类似的东西

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

您必须添加以下定义:

ext {
    compileSdkVersion = 23
    buildToolsVersion = "23.0.1"
    targetSdkVersion = 21
}

答案 1 :(得分:0)

我刚刚通过删除

解决了这个问题

apply plugin: 'android-reporting'

一切都好!