0

Im trying to add a custom xml attribute for my class but this error happens even if I'm not trying to use this attrubte. I just create it in res/values/attrs.xml file like this

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

        <declare-styleable name="my_image">
            <attr name="columns_ratio" format="enum">
                <enum name="1:4" value="3"/>
                <enum name="1:3" value="2"/>
                <enum name="1:2" value="1"/>
                <enum name="1:1" value="0"/>
            </attr>
        </declare-styleable>

</resources>

and I'm getting error messages when trying to make project.

/home/.../app/build/intermediates/res/merged/debug/values/values.xml
Error:(315) No resource found that matches the given name: id '1:1'.
Error:(314) No resource found that matches the given name: id '1:2'.
Error:(313) No resource found that matches the given name: id '1:3'.
Error:(312) No resource found that matches the given name: id '1:4'.
Error:(315) No resource found that matches the given name: id '1:1'.
Error:(314) No resource found that matches the given name: id '1:2'.
Error:(313) No resource found that matches the given name: id '1:3'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

If I just comment out this <declare-styleable> ... </declare-styleable> from attrs.xml file, the problem goes away.

Why is this happening? Remember that I'm not even trying to use this attribute and it's still happening.

etrusks
  • 363
  • 3
  • 12

0 Answers0