Attribute already defined with incompatible format (Original attribute defined here)

我的未来我决定 提交于 2019-12-05 05:33:53

The problem appears when different versions of the same library present within the application. In this case, different versions of support library.

If you don't see them in your gradle file, then they are probably added as dependencies. Run the following in terminal, to see the dependencies for each library:

./gradlew app:dependencies

Then, find the libraries that use old versions of appcompat and update / remove, whatever suits you.

You have the same property name as the other controls, and modify the name of the property of your custom control

<declare-styleable name="MyBgView">
        <attr name="textString" format="string" />
        <attr name="textSizes" format="dimension" />
        <attr name="triangleSize" format="dimension" />
        <attr name="backgrounds" format="color" />
        <attr name="textColors" format="color" />

Android sdk is not avoid to extended attributes.Use up parent namespace

<declare-styleable name="AppBarLayout_Layout" parent="AppBarLayout_LayoutParams">
    <attr name="layout_scrollFlags">
</declare-styleable>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!