javaandroidxmlkotlincustom-view

Creating Custom params for custom layout getting error Illegal char <:> at index 65: packageName.app-mergeDebugResources-54:/values/values.xml


I am getting this error when I create custom params for my custom layout

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="RichTextLayout">
        <attr name="placeHolder" format="string" localization="suggested" />
        <attr name="imageAspectRatio" format="string"/>
        <attr name="editorTextColor" format="color" />
        <attr name="editorBackgroundColor" format="color" />
    </declare-styleable>
</resources>

Note that this code worked for 3-4 days but after updating Android SDK version 32 to 33 it stopped working and start giving the above error.

Error log

Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
   > Resource compilation failed (Failed to compile values resource file C:\Users\Desktop\Code\app\build\intermediates\incremental\debug\mergeDebugResources\merged.dir\values\values.xml. Cause: java.nio.file.InvalidPathException: Illegal char <:> at index 65: packageName.app-mergeDebugResources-54:/values/values.xml). Check logs for more details.
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 65: packageName.app-mergeDebugResources-54:/values/values.xml

Solution

  • Don't know why but after changing param names it started working again

    <resources>
        <declare-styleable name="RichTextLayout">
            <attr name="RT_editorPlaceHolderText" format="string" localization="suggested" />
            <attr name="RT_editorImageAspectRatio" format="string"/>
            <attr name="RT_editorTextColor" format="color" />
            <attr name="RT_editorBackgroundColor" format="color" />
        </declare-styleable>
    </resources>