gregkorossy / Android-Support-Preference-V7-Fix

Android androidx.preference support library has some issues, this lib tries to fix them.
https://discord.gg/87NVsSK
Apache License 2.0
497 stars 46 forks source link

"Error: Attribute "size" already defined with incompatible format." when including library #101

Closed FranckRJ closed 6 years ago

FranckRJ commented 6 years ago

When i add the line compile 'com.takisoft.fix:preference-v7-colorpicker:26.1.0.2' in my build.gralde i got this error. When i click on it it show me these lines in a values.xml file :

<declare-styleable name="ColorPickerPaletteFlex"><attr format="reference" name="currentColor"/><attr format="reference" name="colors"/><attr format="boolean|reference" name="sortColors"/><attr format="reference" name="colorDescriptions"/><attr format="integer|reference" name="columns"/><attr format="enum|reference" name="size">
            <enum name="large" value="1"/>
            <enum name="small" value="2"/>
        </attr></declare-styleable>
    <declare-styleable name="ColorPickerPreference"><attr format="reference" name="currentColor"/><attr format="reference" name="colors"/><attr format="boolean|reference" name="sortColors"/><attr format="reference" name="colorDescriptions"/><attr format="integer|reference" name="columns"/><attr format="enum|reference" name="size">
            <enum name="large" value="1"/>
            <enum name="small" value="2"/>
        </attr></declare-styleable>

I use Android Studio 2.3.3.

gregkorossy commented 6 years ago

Yes, this is a known "bug" due to the limitations of how Android handles the custom attributes. It's going to be fixed in the next release.

FranckRJ commented 6 years ago

Thanks for the reply.

gregkorossy commented 6 years ago

By the way, I think this error does not show up in Android Studio 3.0+. At least it seems to me that 2.3.3 makes the "size" attribute collide within the library, but Android Studio 3.0 does not have this problem. Probably the new gradle plugin is smarter.

gregkorossy commented 6 years ago

Should be fixed since v26.1.0.3. All custom attributes must be prefixed with pref_.