3

将维基词典项目导入 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').
4

3 回答 3

3

Android 资产打包工具 (aapt) 在其最新版本中变得非常严格,现在可用于所有 Android 版本。您得到的 aapt-error 是因为它不再允许使用非位置格式说明符而生成的。

因此,您必须对 C:\Trunk\Wiktionary\res\values\strings.xml 文件进行一些更改。

使用 %% 而不是 % 然后清理并构建项目。

于 2010-12-29T05:58:58.337 回答
3

我遇到了同样的问题。添加 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>
于 2011-11-30T17:01:03.577 回答
3

将构建目标从 1.5 或 1.6 更改为 2.2(API 版本 8)

更新 res\values\string.xml 并将 % 替换为 %%

于 2011-09-08T20:31:04.033 回答