在将Wiktionary项目导入到Eclipse中时,我立即得到与我的strings.xml文件相关的错误消息。无论我是通过subversion还是从SDK示例文件下载项目,都会出现相同的错误。
控制台错误:
[2010-12-27 15:25:33 - Wiktionary] W/ResourceType( 2752): Bad XML block: header size 62 or total size 0 is larger than data size 0
[2010-12-27 15:25:33 - Wiktionary] C:\Trunk\Wiktionary\res\values\strings.xml:22: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
[2010-12-27 15:25:33 - Wiktionary] C:\Trunk\Wiktionary\res\values\strings.xml:22: error: Unexpected end tag string
[2010-12-27 15:25:33 - Wiktionary] C:\Trunk\Wiktionary\res\layout\widget_message.xml:24: error: Error: No resource found that matches the given name (at 'text' with value '@string/widget_loading').
[2010-12-27 15:25:33 - Wiktionary] C:\Trunk\Wiktionary\res\xml\searchable.xml:17: error: Error: No resource found that matches the given name (at 'label' with value '@string/search_label').
[2010-12-27 15:25:33 - Wiktionary] C:\Trunk\Wiktionary\res\xml\searchable.xml:17: error: Error: No resource found that matches the given name (at 'hint' with value '@string/search_hint').
[2010-12-27 15:25:33 - Wiktionary] C:\Trunk\Wiktionary\res\menu\lookup.xml:19: error: Error: No resource found that matches the given name (at 'title' with value '@string/lookup_search').
[2010-12-27 15:25:33 - Wiktionary] C:\Trunk\Wiktionary\res\menu\lookup.xml:24: error: Error: No resource found that matches the given name (at 'title' with value '@string/lookup_random').
[2010-12-27 15:25:33 - Wiktionary] C:\Trunk\Wiktionary\res\menu\lookup.xml:29: error: Error: No resource found that matches the given name (at 'title' with value '@string/lookup_about').发布于 2010-12-29 13:58:58
Android Asset Packaging Tool (aapt)在其最新版本中变得非常严格,现在用于所有Android版本。生成aapt-error是因为它不再允许非位置格式说明符。
因此,您必须对C:\Trunk\Wiktionary\res\values\strings.xml文件进行一些更改。
使用%%而不是%,然后清理并构建项目。
发布于 2011-09-09 04:31:04
将构建目标从1.5或1.6更改为2.2 (API版本8)
更新res\values\string.xml并将%%替换为%%
发布于 2011-12-01 01:01:04
我也遇到过同样的问题。添加1$ & 2$来指定位置就行了。从strings.xml中更正的行是:
<string name="template_user_agent">"%1$s/%2$s (Linux; Android)"</string>
<string name="template_wotd_title">"Wiktionary:Word of the day/%1$s %2$s"</string>https://stackoverflow.com/questions/4541858
复制相似问题