string.xml问题代码
<string name="msg">书名:%s\n价格:%d</string>
异常信息
Error:(949) Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
Error:(949) Unexpected end tag string
Error:(949) Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
Error:(949) Unexpected end tag string
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
解决办法:
<string name="msg">书名:%1$s\n价格:%2$d</string>
本文介绍了一种常见的string.xml文件中格式错误导致的问题及其解决办法。主要错误为在非定位格式字符串中指定了多个替换项,通过正确指定定位格式解决了该问题。
1万+

被折叠的 条评论
为什么被折叠?



