无法获得未知财产' compileSdkVersion'对于根项目' Cropimg'的类型为org.gradle.api.Project。

时间:2017-11-11 13:48:13

标签: android gradle compiler-errors android-gradle

我正在使用一个库,当我同步我的项目时,我收到此错误 无法获得未知财产' compileSdkVersion'对于根项目' Cropimg'的类型为org.gradle.api.Project。 我的gradle是

apply plugin: 'com.android.library'
gradle-builds
apply plugin: 'maven-publish'

android {

compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
    minSdkVersion 14
    targetSdkVersion 26
    versionCode 1
    versionName PUBLISH_VERSION
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
    abortOnError false
}
}


android.libraryVariants
publishing {
publications {
    maven(MavenPublication) {

        groupId PUBLISH_GROUP_ID
        artifactId PUBLISH_ARTIFACT_ID
        version PUBLISH_VERSION + '-SNAPSHOT'

        //artifact bundleRelease
    }
}
}

dependencies {
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile("com.android.support:exifinterface:$supportLibraryVersion") {
    transitive = false
}
}

1 个答案:

答案 0 :(得分:2)

在你的项目中,build.gradle声明compileSdkVersion

`

ext {
    compileSdkVersion = 26
    buildToolsVersion = '26.0.2'

 }

`