【问题标题】:Could not get unknown property 'ANDROID_SUPPORT_VERSION' for project ':demo' of type org.gradle.api.Project无法为 org.gradle.api.Project 类型的项目“:demo”获取未知属性“ANDROID_SUPPORT_VERSION”
【发布时间】:2019-06-22 05:14:39
【问题描述】:

我正在尝试在我的 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"
}

【问题讨论】:

    标签: android build.gradle


    【解决方案1】:

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

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

    这是您可能需要添加到项目中的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
    

    【讨论】:

    • 谢谢,但在我这样做之后,出现了这个新错误Supplied proguard configuration file name is unsupported. Valid values are: [proguard-android-optimize.txt, proguard-defaults.txt, proguard-android.txt]
    • 另一个与您之前的问题无关的错误。检查您的模块 build.gradle` 是否使用正确的 build.gradle 行,如下所示:proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    • 问题出在您导入的库中。将导入库中的以下行 proguardFiles getDefaultProguardFile('proguard-android.pro'), 'proguard-rules.txt' 更改为我之前评论中的 lin。
    • 非常感谢...是的,我做到了,但很抱歉出现另一个错误Error: java.lang.RuntimeException: java.lang.RuntimeException: Error while processing D:\android projects\Amas\demo\src\main\res\drawable\logo.xml : For input string: "@integer/logo_viewport_side"
    • 很抱歉这是我第一次导入库
    猜你喜欢
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 2023-01-25
    • 1970-01-01
    • 2017-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多