aapt命令详解
aapt是android自动打包工具之一。
环境配置:
aapt一般在android sdk
的build-tools
中对应文件夹里面,将其路径添加到环境变量中,即可在命令行中直接使用aapt命令;
aapt参数详解
aapt 命令后可直接查看参数详解
aapt l[ist] [-v] [-a] file.{zip,jar,apk}
-
aapt l xxx.apk
:查看apk目录 -
aapt l -a xxx.apk
:详细列出apk内容;
若内容较多,可保存到本地文件中,如aapt l -a xxx.apk > xxx.txt
-
aapt l -v xxx.apk
: 以table的形式输出目录- table的表目有:Length、Method、Size、Ratio、Date、Time、CRC-32、Name。
- 其中Method表示压缩形式,有:Deflate及Stored两种,即该Zip目录采用的算法是压缩模式 or 存储模式。
- 可以看出resources.arsc、*.png采用压缩模式,而其它采用压缩模式。
- Ratio表示压缩率。CRC-32未明其意,Sodino盼指教。
-
aapt dump 命令
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-
aapt d badging xxx.apk
:显示标签、图标和应用程序的相关描述 -
aapt d permissions xxx.apk
:显示apk所具有的系统权限 -
aapt d resources xxx.apk
:查看apk资源 -
aapt d configurations xxx.apk
:查看apk配置 -
aapt d xmltree facebook_googleplay_V1.0.0.apk res/anim-v21/design_bottom_sheet_slide_out.xml
:查看xml的树形结构 -
aapt d xmlstrings facebook_googleplay_V1.0.0.apk res/anim-v21/design_bottom_sheet_slide_out.xml
:查看xml中所有的string
-
Demo:
查找apk包中所有Activity的名称
通过查找AndroidManifest.xml
文件内容来定位:
aapt dump xmltree facebook_googleplay_V1.0.0.apk \
AndroidManifest.xml | grep activity
始发于2017.6.13