Android studio : Gradle : Attribute ... has already been defined error

3.7k views Asked by At

I am migrating from eclipse-ADT to Android studio and getting this error while building :-

AGPBI: {"kind":"ERROR","text":"Attribute \"track\" has already been defined","sourcePath":"C:\\densie\\project\\src\\main\\res\\values\\colors.xml","position":{"startLine":1},"original":""}


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':keyOff:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\180336\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.782 secs

And colors.xml is like :-

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="clicked">#7700ccff</color>
    <color name="red">#ffff0000</color>
    <color name="dark">#ff303030</color>
    <color name="white">#ffffffff</color>
    <color name="color_cyan_0">#ff86B6aD</color>
    <color name="black">#ff000000</color>
    <color name="grey">#ff808080</color>
    <color name="menu_grey">#ff888888</color>
    <color name="light_grey">#ffcccccc</color>
    <color name="dark_white">#ffdddddd</color>
    <color name="active_guest">#7777ff</color>
    <color name="light_green">#33aa99</color>
    <color name="ttms_green">#00fcfc</color>

There is no "track" attribute in it.

Kindly help. I have already spent a lot of time googling it or looking into forums and it's really frustrating.

1

There are 1 answers

0
erginduran On

Please remove compile 'com.android.support:appcompat-v7:22.2.0' (maybe ur version is different) from dependencies in app/build.gradle file.Then *Tools>Android>Sync with Gradle files*. and *Build>Clean Project & Rebuild*.
More: