Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use multiple -S values with aapt without using <add-resource>?

Tags:

android

aapt

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.

Currently, src/com/example/ui/res/values/strings.xml contains the following:

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

I would prefer not to have to change this to:

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

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

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

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.

like image 816
bolinfest Avatar asked Jul 19 '12 21:07

bolinfest


1 Answers

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.

like image 58
bolinfest Avatar answered Oct 15 '22 02:10

bolinfest