文档在Ant脚本AAPT元 [英] Documentation for aapt element in Ant script
问题描述
我工作的一些Ant脚本用于在Android构建系统和所遇到的一个元素调用AAPT。我见过很多例子与
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可执行=$ {} AAPT
exec executable="${aapt}"
但那些出来的main_rules.xml文件使用不同的格式为:
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?
感谢
推荐答案
在新的(ER)版本的Android SDK的,蚂蚁构建脚本作品以不同的方式。
它不直接通过 EXEC
元素,而是定义调用的 AAPT 的命令
一个AAPT的任务。
后者是由java类 com.android.ant.AaptExecTask
实施。
这个类仅提供的AAPT命令行选项的子集。
In the new(er) version of the Android SDK, the ant build script works in a different way.
It does not directly invoke the aapt command via an exec
element but rather defines
an aapt task.
The latter one is implemented by the java class com.android.ant.AaptExecTask
.
This class only provides a subset of the aapt command line options.
您可以找到AAPT命令行选项和下面的蚂蚁参数之间的映射的简要说明作为开源Java文档中:
You can find a brief description of the mapping between aapt command line options and the ant parameters below as found in the source java doc:
Aapt Option Ant Name Type
---------------------------------------------------------------------------------
path to aapt executable attribute (Path)
command command attribute (String)
-v verbose attribute (boolean)
-f force attribute (boolean)
-M AndroidManifest.xml manifest attribute (Path)
-I base-package androidjar attribute (Path)
-A asset-source-dir assets attribute (Path
-S resource-sources <res path=""> nested element(s)
with attribute (Path)
-0 extension <nocompress extension=""> nested element(s)
<nocompress> with attribute (String)
-F apk-file apkfolder attribute (Path)
outfolder attribute (Path) deprecated
apkbasename attribute (String)
basename attribute (String) deprecated
-J R-file-dir rfolder attribute (Path)
-m always enabled
据我发现,没有办法提供通过这一新的建设任务,一般AAPT选项。这只能通过采取SDK的build.xml经过修改的版本似乎是可能的 与替代的AAPT调用。
As far as I found out, there is no way to provide the generic aapt options through this new build task. This seems to be possible only by taking a modified copy of the SDK's build.xml with replacements for the aapt invocations.
如果有人知道一个更好的解决方案,我会很高兴地了解,也; - )
If anyone knows a better solution, I'd be glad to read about, too ;-)
编辑:即使新版本的SDK再次推出重命名的包:
In even newer versions of the SDK the introduced renaming packages again:
Aapt Option --rename-manifest-package package-name
Ant Name manifestpackage
Type attribute (String)
这篇关于文档在Ant脚本AAPT元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!