Android aapt 在 Mac 上的使用

最近需要用到android sdk的aapt来解析apk包,这里我分享一下我的使用过程,首先配置aapt的环境变量:

AAPT_HOME=/Users/admin/Library/Android/sdk/build-tools/29.0.3
export AAPT_HOME
export PATH=$PATH:$AAPT_HOME

把这几行加入到~/.zshrc中去,然后测试,重新打开一个terminal:

(base) ➜  ~ aapt
Android Asset Packaging Tool

Usage:
 aapt l[ist] [-v] [-a] file.{zip,jar,apk}
   List contents of Zip-compatible archive.

 aapt d[ump] [--values] [--include-meta-data] WHAT file.{apk} [asset [asset ...]]
   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.

说明添加成功,然后进行操作,这里以拼多多的apk为例:

(base) ➜  android aapt dump badging 拼多多官方.apk
package: name='com.xunmeng.pinduoduo' versionCode='51101' versionName='5.11.1' compileSdkVersion='29' compileSdkVersionCodename='10'
sdkVersion:'15'
targetSdkVersion:'27'
uses-permission: name='android.permission.INTERNET'
uses-permission: name='android.permission.ACCESS_WIFI_STATE'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.READ_PHONE_STATE'
uses-permission: name='android.permission.READ_LOGS'
uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'
uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
uses-permission: name='android.permission.CAMERA'
uses-permission: name='android.permission.FLASHLIGHT'
uses-permission: name='android.permission.READ_CONTACTS'
uses-permission: name='android.permission.RECORD_AUDIO'
uses-permission: name='android.permission.MODIFY_AUDIO_SETTINGS'
uses-permission: name='android.permission.WAKE_LOCK'
uses-permission: name='android.permission.GET_PACKAGE_SIZE'
uses-permission: name='android.permission.REQUEST_INSTALL_PACKAGES'
.....

参考文献

[1].Android aapt 在 Mac 和 Windows 上使用方法小结. https://www.jianshu.com/p/00b83e34f8bf

[2].Mac 配置AAPT环境变量. https://blog.csdn.net/sweetzhangxue/article/details/75557652

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

农民小飞侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值