ADT shows error in Strings.xml

Ragunath Jawahar picture Ragunath Jawahar · Dec 19, 2010 · Viewed 13.4k times · Source

I updated my ADT to the latest version after Gingerbread was released. And now

<string name="date_format">%d:%d %s</string>

shows the following error

Multiple annotations found at this line:
- error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" 
 attribute?
- error: Unexpected end tag string

Previous ADT version worked fine. Am I doing something wrong? I get this error whenever there are more than 1 format specifiers.

Answer

hopia picture hopia · Dec 30, 2010

Or, alternatively, you can modify your % format specifiers to use argument indices, like so:

<string name="date_format">%1$d:%2$d %3$s</string>

More info on the Formatter class in the Android Reference Docs.