本文介绍了我如何使用与AAPT多个-S值,而无需使用<增加资源和GT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过AAPT的命令行来构建R.java。我指定多个 -S 目录,是因为我有多个 RES 目录。我通过构建:

I am trying to build R.java by using aapt from the command line. I am specifying multiple -S directories because I have multiple res directories. I am building by using:

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

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

Unfortunately, I am getting the following error:

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 /例子/ UI / RES /价值/ strings.xml中包含以下内容:

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

我想preFER不要有这种更改为:

I would prefer not to have to change this to:

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

(此建议在<一个href=\"https://groups.google.com/forum/?fromgroups#!topic/android-porting/bYfeLEjERjg\">https://groups.google.com/forum/?fromgroups#!topic/android-porting/bYfeLEjERjg,虽然它并不甚至似乎解决了我的问题。)

(This was suggested on https://groups.google.com/forum/?fromgroups#!topic/android-porting/bYfeLEjERjg, though it does not even seem to solve my problem.)

我在我的 -S 参数应该如何工作的期望误导?

Am I misguided in my expectation of how the -S argument should work?

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

The only workaround I can think of is to symlink all of my -S directories as subdirectories of the root res directory and to specify res as the only -S directory.

推荐答案

我相信,解决办法是使用 - 自动添加的覆盖标记。我用 -v 运行默认Ant构建脚本的详细模式发现了这个。

I believe the solution is to use the --auto-add-overlay flag. I discovered this by running the default Ant build script with -v for verbose mode.

这篇关于我如何使用与AAPT多个-S值,而无需使用&LT;增加资源和GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 00:56