"Tag start is not closed" when commenting inside XML element's start and end tag

user3801167 picture user3801167 · Sep 7, 2014 · Viewed 10.5k times · Source

<!-- Comment --> is the way to add comments in an XML file. Doesn't that actually means, that this part is not "compiled"?

However, when I do something like this:

<item android:id="@+id/ss3"
    android:icon="@drawable/some_icon"
    android:title="Blabla Title"
    tools:ignore="AppCompatResource"
    <!-- -->
/>

I get an error "Tag start is not closed". Why?

Answer

Miro Lehtonen picture Miro Lehtonen · Sep 7, 2014

Comments are not allowed inside tags. You have to close the tag first with ">" or "/>" and then you can add your comment there.