aapt使用,和的區別

最近需要解析andriod apk中的 "permission" 信息,發現了一個很好的工具--- aapt。

aapt是Android Asset Packaging Tool的縮寫,可以查看,創建,更新zip格式的文檔附件,包括zip, jar, apk。也可以將資源文件編譯成二進制文件。在SDK的build-tools目錄下。

安裝參考 http://blog.csdn.net/cheligeer1988/article/details/10932305
安裝之後,通過命令行可以使用aapt。

$ aapt
Usage:

1. 列出apk包的內容
 aapt l[ist] [-v] [-a] file.{zip,jar,apk}

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

3. 查看aapt的版本   
 aapt v[ersion]
   Print program version.
   
目前我只使用這三個命令,aapt的功能還有打包(編譯),從apk中添加或刪除某個文件。
通過命令行aapt,可以展示aapt的使用方法。
如有需要,再詳細學習其他的。

參考
http://www.cnblogs.com/JianXu/p/5330213.html

另外,在aapt d[ump] 的中使用 badging選項時,會輸出一些apk的信息,但是不包括apk包中的 permission 信息。只有使用 permissions選項時,會輸出 uses-permission 和 permission 信息。

uses-permission 表示該apk需要使用的一些權限;
permission      表示該apk聲明的一些權限,如果其他的apk需要使用時,需要聲明,即使用uses-permission聲明。




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章