aapt使用,<uses-permission>和<permission>的区别

最近需要解析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声明。




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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值