更新SDK工具并播放服务库后,构建失败

时间:2015-06-02 08:07:23

标签: android gradle android-gradle build.gradle

您好我目前更新了我的SDK工具以及SDK的其他组件,但M-preview和我目前无法使用的示例文件除外。现在问题是在更新库并同步gradle之后它给了我这个错误:

error: Attribute "track" has already been defined
error: Attribute "thumbTextPadding" has already been defined
error: Attribute "switchMinWidth" has already been defined
error: Attribute "switchPadding" has already been defined

现在我的应用程序由于此值错误而无法构建或运行,因此我不确定其发生的原因。这是我当前的gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    lintOptions{
        checkReleaseBuilds false
        abortOnError true
    }

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 17
        versionName "1.1.0"
    }
    buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}



dependencies {
    compile 'com.android.support:design:22.2.0'
    compile 'com.joooonho:selectableroundedimageview:1.0.1'
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'in.srain.cube:grid-view-with-header-footer:1.0.9'
    compile 'com.felipecsl.quickreturn:library:1.5.1'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
    compile 'it.sephiroth.android.library.imagezoom:imagezoom:+'
    compile 'com.makeramen:roundedimageview:1.5.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libraries:facebook')
}

有人能指出我为什么会这样吗? TIA。

1 个答案:

答案 0 :(得分:1)

通过它看你正在使用的属性,即

 error: Attribute "track" has already been defined
    error: Attribute "thumbTextPadding" has already been defined
    error: Attribute "switchMinWidth" has already been defined
    error: Attribute "switchPadding" has already been defined 
M-Preview SDK可能正在使用

。只需在attrs.xml文件中更改您正在使用的Switch的属性,就可以了!