Documentation for aapt element in Ant script

Snowwire picture Snowwire · Jul 24, 2011 · Viewed 7.7k times · Source

I'm working on some Ant scripts for an Android build system and have come across an element to call aapt. I have seen lots of examples with

exec executable="${aapt}"

but the ones that come out of the main_rules.xml file use a different format

    <aapt executable="${aapt}"
            command="package"
            debug="${build.packaging.debug}"
            manifest="AndroidManifest.xml"
            assets="${asset.absolute.dir}"
            androidjar="${android.jar}"
            apkfolder="${out.absolute.dir}"
            resourcefilename="${resource.package.file.name}"
            resourcefilter="${aapt.resource.filter}">
        <res path="${resource.absolute.dir}" />
        <!-- <nocompress /> forces no compression on any files in assets or res/raw -->
        <!-- <nocompress extension="xml" /> forces no compression on specific file extensions in assets and res/raw -->
    </aapt>

I would like to rename the package using this element, but cannot find any documentation about how to use it. Does anyone know where I can find some?

Thanks

Answer

Snowwire picture Snowwire · Jul 26, 2011

I couldn't find anything and ended up using the following which seems to work

    <exec executable="${aapt}" failonerror="true">
      <arg value="package" />
      <arg value="-f" />
      <arg value="-v" />
      <arg value="-M" />
      <arg path="AndroidManifest.xml" />
      <arg value="-A" />
      <arg path="assets" />
      <arg value="-I" />
      <arg path="${android.jar}" />
      <arg value="-m" />
      <arg value="-J" />
      <arg path="${out.absolute.dir}" />
      <arg value="-F" />
      <arg path="${out.absolute.dir}/${resource.package.file.name}" />
      <arg value="-S" />
      <arg path="res" />
      <arg value="--rename-manifest-package" />
      <arg value="my.new.package.name" />
    </exec>