aapt dump命令
aapt (Android Asset Packaging Tool),Android资源打包工具,也可以用来查看apk中的一些字段信息
主要使用aapt dump命令,这里记录一下
aapt d[ump] [–values] [–include-meta-data] WHAT file.{apk} [asset [asset …]]
command | use |
---|---|
strings | Print the contents of the resource table string pool in the APK. |
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. |
1.查看所有string字段
aapt dump strings xxx.apk
2.查看label,packageName,versionCode,launchActivity等应用信息
aapt dump badging xxx.apk
3.查看应用注册的权限
aapt dump permissions xxx.apk
4.查看res资源信息,比如某些config属性值
aapt dump resources xxx.apk >res.txt
一边资源较多,保存为文件方便查看,比如查看系统某些属性值
aapt dump strings framework-res.apk >res.txt
在res.txt中寻找config_screenBrightnessSettingMaximum值,为屏幕背光最大值
resource 0x010e00aa android:integer/config_screenBrightnessSettingMaximum: t=0x10 d=0x000007ff (s=0x0008 r=0x00)
其中d=0x000007ff中7ff为16进制,可以使用工具转换成10进制,linux上可以使用命令
printf %d 0x7ff
实际值为2047
5.参看配置信息
aapt dump configurations xxx.apk
6.以xml的方式输出给定的assets文件
aapt dump xmltree framework-res.apk res/xml/power_profile.xml
7.以string输出给定的assets文件
aapt dump xmlstrings framework-res.apk res/xml/power_profile.xml