使用“aapt dump”查看APK内容

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包内容:aapt list test.apk

显示resources:aapt dump --values resources test.apk

查看XML文件内容:aapt dump xmltree test.apk AndroidManifest.xml

[其他反编译工具]

java -jar AXMLPrinter2.jar AndroidManifest.xml

把dex文件反编译为jar文件的工具。(dex2jar)

把jar反编译为java的工具。(JD-GUI)

 

 

aapt 是android assertpackaging tool的缩写,具体如下:


1. 列出apk包的内容

aapt l[ist][-v] [-a] file.{zip,jar,apk}

-v以table形式列出来

-a详细列出内容

例如:aapt l<你的apk文件>,这个命令就是查看apk内容

2. 查看apk一些信息

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

badging Print the label andicon 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 xmlassets.

例如:aapt d permissions<apk文件>, 这个就是显示这个apk所具有的权限

3. 编译android资源

aapt p[ackage][-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] /
[-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile]/
[--debug-mode] [--min-sdk-version VAL] [--target-sdk-version VAL]/
[--app-version VAL] [--app-version-name TEXT] [--custom-packageVAL] /
[--rename-manifest-package PACKAGE] /
[--rename-instrumentation-target-package PACKAGE] /
[--utf16] [--auto-add-overlay] /
[--max-res-version VAL] /
[-I base-package [-I base-package ...]] /
[-A asset-source-dir] [-G class-list-file] [-Ppublic-definitions-file] /
[-S resource-sources [-S resource-sources ...]] [-F apk-file] [-JR-file-dir] /
[--product product1,product2,...] /
[raw-files-dir [raw-files-dir] ...]

这个比较复杂,只解释几个关键参数。

-f 如果编译出来的文件已经存在,强制覆盖。

-m 使生成的包的目录放在-J参数指定的目录。

-J 指定生成的R.java的输出目录

-S res文件夹路径

-A assert文件夹的路径

-M AndroidManifest.xml的路径

-I某个版本平台的android.jar的路径

-F具体指定apk文件的输出

例如:

一.将工程的资源编译R.java文件

aaptpackage -m -J <R.java目录> -S<res目录> -I<android.jar目录> -M<AndroidManifest.xml目录>

二.将工程的资源编译编译到一个包里

aaptpackage -f -S <res目录> -I<android.jar目录>-A<assert目录> -M<AndroidManifest.xml目录> -F<输出的包目录>

4.打包好的apk中移除文件

aaptr[emove] [-v] file.{zip,jar,apk} file1 [file2...]

例如:aapt r<你的apk文件> AndroidManifest.xml,这个就是将apk中的AndroidManifest移除掉

5.添加文件到打包好的apk中

aapta[dd] [-v] file.{zip,jar,apk} file1 [file2...]

例如:aapt a<你的apk文件><要添加的文件路径>,这个就是将文件添加到打包好的apk文件中

6.显示aapt的版本

aaptv[ersion]

例如:aapt v,就是打印这个结果 Android Asset Packaging Tool,v0.2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值