您的位置:首页 > 移动开发 > Android开发

Android SDK aapt工具常用命令语句

2015-04-23 11:57 344 查看
           aapt即Android Asset Packaging Tool,在SDK的build-tools目录下。该工具可以查看,创建, 更新ZIP格式的文档附件(zip, jar, apk)。也可将资源文件编译成二进制文件,尽管你可能没有直接使用过aapt工具,但是build
scripts和IDE插件会使用这个工具打包apk文件构成一个Android
应用程序。在使用aapt之前需要在环境变量里面配置SDK-tools路径,或者是路径+aapt的方式进入aapt。

aapt l[ist]:列出资源压缩包里的内容。

aapt d[ump]:查看APK包内指定的内容。

aapt p[ackage]:打包生成资源压缩包。

aapt r[emove]:从压缩包中删除指定文件。

aapt a[dd]:向压缩包中添加指定文件。

aapt v[ersion]:打印aapt的版本。

下面举例介绍几个常见用于APK文件操作的命令语句:

1.
aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]]

badging         
Print the label and icon for the app declared in APK
permissions      Print the permissions from the APK.
resources        Print the resource table from the APK.
configurations   Print the configurations in the APK.
xmltree          Print the compiled xmls in the given assets.
xmlstrings       Print the strings of the given compiled xml assets.

例如查看apk压缩文件中AndroidManifest.xml内容:



回车运行:



当AndroidManifest.xml输出内容过多时,可以使用重定向符号">"将所有信息写到指定的一个文件如AndroidManifest.txt里面:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: