aapt 命令查看apk包名(aapt命令大全)

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

2.aapt 命令可应用于查看apk包名、主activity、版本等很多信息
首先在你本机必须有一个aapt.exe.
下载地址: http://download.csdn.net/download/gtncwy/10225931

这里我把它放在D:\AAPT这个目录下,同时我在这个目录里放了一个apk包,以便于使用aapt查看这个apk包的信息
在左面上Windows+R 打开运行界面输入cmd进入dos命令界面。
图片1


输入cd AAPT进入所在文件夹

图片1


输入d: 进入aapt所在的盘符


图片1

接下来咱门就可以使用aapt命令了 
输入aapt.exe可以看到aapt命令的一些使用方法,如果你不知道相应的命令可以在这里查看
图片3

输入 aapt dump bading Game.apk  查看包的相关信息。(Gamen.apk是android包所在的位置和名称)
图片4

如果你想把以上的信息放在某个文本中可以使用
aapt dump bading Game.apk > out.txt 这样在aapt.exe的同级目录下就可以找打一个out.txt

图片6

图片1

图片1


3.一些使用AAPT工具的用法

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

 List contents of Zip-compatible archive.

1.1 列出压缩文件目录
aapt l <file_path.apk>
参数:
-v:会以table的形式输出目录,table的表目有:Length、Method、Size、Ratio、Date、Time、CRC-32、Name。
其中Method表示压缩形式,有:Deflate及Stored两种,即该Zip目录采用的算法是压缩模式还是存储模式;可以看出resources.arsc、*.png采用压缩模式,而其它采用压缩模式。
Ratio表示压缩率。CRC-32未明其意,Sodino盼指教。
-a:会详细输出所有目录的内容

2. 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.

2.1 查看apk包的packageName、versionCode、applicationLabel、launcherActivity、permission等各种详细信息
aapt dump badging <file_path.apk>


2.2 查看权限
aapt dump permissions <file_path.apk>


2.3 查看资源列表
aapt dump resources <file_path.apk>
一般都会输出很多的信息,如要全部查看,请用下面这两句:
aapt dump resources <file_path.apk>   > sodino.txt
sodino.txt
这样会把所有的信息通过重定向符">"输出到sodino.txt文件中,然后再打开该文件即可查看。


2.4 查看apk配置信息
aapt dump configurations <file_path.apk>


2.5 查看指定apk的指定xml文件。
aapt dump xmltree <file_path.apk> res/***.xml
以树形结构输出的xml信息。
aapt dump xmlstrings <file_path.apk> res/***.xml
输出xml文件中所有的字符串信息。



猜你喜欢

转载自blog.csdn.net/gtncwy/article/details/79174324