Wednesday, December 8, 2010

Multiple substitutions specified in non-positional format

Since Android SDK 2.3 there's a new error:
error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?

Description:
This error indicates you're using a string resource with %s in it. See how to use it here under 'Formatting strings'. In general, instead of:
Hello, %s! You have %d new messages.
Should be:
Hello, %1$s! You have %2$d new messages.