medyo / Fancybuttons

Icons, Borders, Radius ... for Android buttons
1.77k stars 397 forks source link

Error:(1) Attribute "text" has already been defined #13

Closed gordonpro closed 9 years ago

gordonpro commented 9 years ago

I use Android Studio compile this lib as dependency

compile 'com.github.medyo:fancybuttons:1.1@aar'

then get this error Error:(1) Attribute "text" has already been defined

medyo commented 9 years ago

Please provide the entire code.

gordonpro commented 9 years ago
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.orhanobut:simplelistview:1.2@aar'
compile 'jp.wasabeef:recyclerview-animators:1.1.2@aar'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.github.medyo:fancybuttons:1.1@aar'
compile 'com.pnikosis:materialish-progress:1.5'
medyo commented 9 years ago

I mean have you implemented the library or by just adding compile fancybuttons you receive the error message.

gordonpro commented 9 years ago

Just adding compile.

medyo commented 9 years ago

Same with version 1.0 ?

gordonpro commented 9 years ago

I had known the reason, that is my project had defined a attr as text

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="TextBottomButton">
        <attr name="src" format="reference" />
        <attr name="bg" format="reference" />
        <attr name="text" format="string" />
    </declare-styleable>
    <declare-styleable name="LabelTextView">
        <attr name="drawable" format="reference" />
        <attr name="label" format="string" />
    </declare-styleable>
</resources>

it has conflict.

gordonpro commented 9 years ago

I think the attrs.xml should declared with namespace. like https://github.com/pnikosis/materialish-progress/blob/master/library/src/main/res/values/attrs.xml

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

    <declare-styleable name="ProgressWheel">
        <attr name="matProg_progressIndeterminate" format="boolean" />
        <attr name="matProg_barColor" format="color" />
        <attr name="matProg_rimColor" format="color" />
        <attr name="matProg_rimWidth" format="dimension" />
        <attr name="matProg_spinSpeed" format="float" />
        <attr name="matProg_barSpinCycleTime" format="integer" />
        <attr name="matProg_circleRadius" format="dimension" />
        <attr name="matProg_fillRadius" format="boolean" />
        <attr name="matProg_barWidth" format="dimension" />
        <attr name="matProg_linearProgress" format="boolean" />
    </declare-styleable>

</resources>
medyo commented 9 years ago

You're right, the attribute names used might be in conflicts with some other libraries. What namespace do you think is suitable for fancybuttons ? a short one :smile:

gordonpro commented 9 years ago
<attr name="medyoFB_text" format="string" />
medyo commented 9 years ago

Too long, i think i'll go with fancy_ as namespace for all attributes like this :

fancy:fancy_textColor
fancy:fancy_textFont

There is less chances that other library uses the same

medyo commented 9 years ago

it's been fixed here #23