Gradle 错误“属性"“xxx"已经定义"在 Android Studio 中 [英] Gradle error "Attribute "xxx" has already been defined" in Android Studio

查看:30
本文介绍了Gradle 错误“属性"“xxx"已经定义"在 Android Studio 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android Studio 中创建了一个项目并使用 Maven Central 添加了一些依赖项,当我尝试编译时,我遇到了此类错误:

I created a project in Android Studio and added a few dependencies using Maven Central and when I try to compile, I run into this type of errors:

Error:Gradle: Attribute "titleTextStyle" has already been defined
Error:Gradle: Attribute "subtitleTextStyle" has already been defined
[...]

等等...这是我的 build.gradle 文件:

And so on... Here is my build.gradle file:

buildscript {
    repositories {
    mavenCentral()
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 18
    buildToolsVersion "17.0.0"

    defaultConfig {
    minSdkVersion 8
    targetSdkVersion 18
    }
}

dependencies {
    // Support Libraries
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.android.support:appcompat-v7:18.0.0'
    compile 'com.android.support:support-v13:18.0.0'

    // Third-Party Librairies
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile 'ch.acra:acra:4.5.0'

}

遗憾的是,Make 控制台的功能不如 Eclipse 的控制台,所以我不知道问题的根源.有没有人知道导致这些编译错误的原因?

Sadly the Make Console doesn't speak as much as Eclipse's Console, so I have no idea of the problem's origin. Does anyone have an idea of what causes these compile errors?

推荐答案

你应该在你的依赖项中删除这一行:

You should remove this line in your dependencies :

compile 'com.android.support:appcompat-v7:18.0.0'

这篇关于Gradle 错误“属性"“xxx"已经定义"在 Android Studio 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆