Ant 脚本中 aapt 元素的文档
我正在为 Android 构建系统编写一些 Ant 脚本,并且遇到了一个调用 aapt 的元素。我看过很多
execexecutable="${aapt}"
的示例,但来自 main_rules.xml 文件的示例使用不同的格式
<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'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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找不到任何东西,最终使用了以下似乎有效的方法
I couldn't find anything and ended up using the following which seems to work
在新版本的 Android SDK 中,ant 构建脚本以不同的方式工作。
它不会通过
exec
元素直接调用 aapt 命令,而是定义一项适当的任务。
后一个是由java类
com.android.ant.AaptExecTask
实现的。此类仅提供 aapt 命令行选项的子集。
您可以在下面的源 java 文档中找到 aapt 命令行选项和 ant 参数之间映射的简要说明:
据我所知,无法通过这个新的构建任务提供通用的 aapt 选项。这似乎只能通过修改 SDK 的 build.xml 副本来实现
替换 aapt 调用。
如果有人知道更好的解决方案,我也很高兴阅读;-)
编辑:在 SDK 的更新版本中,再次引入了重命名包:
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 definesan 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.
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:
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 ;-)
EDIT: In even newer versions of the SDK the introduced renaming packages again:
我非常怀疑除了源代码之外还有任何文档。
I highly doubt there is any documentation beyond the source code.