无法获得类型为org.gradle.api.Project

时间:2019-06-22 05:14:39

标签: android build.gradle

我正在尝试在我的android studio项目中使用此库:https://github.com/telly/MrVector。 所以我要做的就是将其作为模块导入到我的项目中,并且在尝试同步项目时 出现此错误

  

无法获得类型为org.gradle.api.Project的项目':demo'的未知属性'ANDROID_SUPPORT_VERSION'。

在此处是Gradle文件中出现问题的地方:

dependencies {
  compile project(':library')
  compile "com.android.support:appcompat-v7:${project.ANDROID_SUPPORT_VERSION}@aar"
}

1 个答案:

答案 0 :(得分:1)

  

无法获得类型为org.gradle.api.Project的项目':demo'的未知属性'ANDROID_SUPPORT_VERSION'。

这是因为您的项目在ANDROID_SUPPORT_VERSION中没有gradle.properties属性,该属性没有导入到您的项目中。您需要添加属性。

以下是您可能需要添加到项目中的MrVector gradle.properties

VERSION_NAME=0.2.0
VERSION_CODE=2
GROUP=com.telly

POM_NAME=Mr. Vector Library
POM_ARTIFACT_ID=mrvector
POM_PACKAGING=aar

POM_DESCRIPTION=Mr. Vector (VectorDrawableCompat): A 7+ backport of VectorDrawable
POM_URL=https://github.com/telly/MrVector
POM_SCM_URL=https://github.com/telly/MrVector
POM_SCM_CONNECTION=scm:git@github.com:telly/MrVector.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:telly/MrVector.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=eveliotc
POM_DEVELOPER_NAME=Evelio Tarazona Caceres

ANDROID_BUILD_MIN_SDK_VERSION=7
ANDROID_BUILD_TARGET_SDK_VERSION=21
ANDROID_BUILD_SDK_VERSION=21
ANDROID_BUILD_TOOLS_VERSION=21.1.2

ANDROID_SUPPORT_VERSION=21.0.3