9

我正在尝试通过从命令行使用 aapt 来构建 R.java。我指定多个-S目录,因为我有多个res目录。我正在使用以下方法构建:

aapt package \
  -M AndroidManifest.xml \
  -m -J gen \
  -S src/com/example/res \
  -S src/com/example/ui/res

不幸的是,我收到以下错误:

src/com/example/ui/res/values/strings.xml:2: error: Resource at app1_name appears in overlay but not in the base package; use <add-resource> to add.

目前,src/com/example/ui/res/values/strings.xml包含以下内容:

<resources>
    <string name="app1_name">MyAppName</string>
</resources>

我宁愿不必将其更改为:

<resources>
    <add-resource type="string" name="app1_name">MyAppName</add-resource>
</resources>

(这是在https://groups.google.com/forum/?fromgroups#!topic/android-porting/bYfeLEjERjg上提出的,尽管它似乎并没有解决我的问题。)

我对-S论证应该如何运作的期望是否被误导了?

我能想到的唯一解决方法是将我的所有目录符号链接-S为根res目录的子目录并指定res为唯一-S目录。

4

1 回答 1

16

我相信解决方案是使用--auto-add-overlay标志。我通过使用-v详细模式运行默认的 Ant 构建脚本发现了这一点。

于 2012-07-20T15:28:55.697 回答