玩转bundletool工具之获取aar包信息

一、前言

  bundletool是一个强大的aar包工具,可以对aar包生成apks集合,检测基础apk包大小等等,可参考:bundletool工具使用详解 一文。在本章节,将详细介绍一下如何使用bundletool工具,从aar中获取各种包信息。

二、使用 dump 命令获取aar包各种信息

2.1 关于 dump 命令

  可以使用 bundletool help dump 查看bundletool工具的 dump 命令的详细介绍,其中包含样例、信息来源分类以及命令选项,如下所示:

Description:
    Prints files or extract values from the bundle in a human-readable form.

    Examples:

    1. Prints the AndroidManifest.xml of the base module:
    $ bundletool dump manifest --bundle=/tmp/app.aab

    2. Prints the versionCode of the bundle of the base module:
    $ bundletool dump manifest --bundle=/tmp/app.aab --
    xpath=/manifest/@versionCode

    3. Prints all the resources present in the bundle:
    $ bundletool dump resources --bundle=/tmp/app.aab

    4. Prints a resource's configs from its resource ID:
    $ bundletool dump resources --bundle=/tmp/app.aab --resource=0x7f0e013a

    5. Prints a resource's configs and values from its resource type & name:
    $ bundletool dump resources --bundle=/tmp/app.aab --resource=drawable/icon
    --values

    6. Prints the content of the bundle configuration file:
    $ bundletool dump config --bundle=/tmp/app.aab

    7. Prints the content of the runtime-enabled SDK configuration file:
    $ bundletool dump runtime-enabled-sdk-config --bundle=/tmp/app.aab

Synopsis:
    bundletool dump <manifest|resources|config|runtime-enabled-sdk-config>
        --bundle=<app.aab>
        [--module=<base>]
        [--resource=<0x7f030001>]
        [--values]
        [--xpath=</manifest/@android:versionCode>]

Flags:
    --bundle: Path to the Android App Bundle.

    --module: (Optional) Name of the module to apply the dump for. Only applies
        when dumping the manifest. Defaults to 'base'.

    --resource: (Optional) Name or ID of the resource to lookup. Only applies
        when dumping resources. If a resource ID is provided, it can be
        specified either as a decimal or hexadecimal integer. If a resource name
        is provided, it must follow the format '<type>/<name>', e.g.
        'drawable/icon'

    --values: (Optional) When set, also prints the values of the resources.
        Defaults to false. Only applies when dumping the resources.

    --xpath: (Optional) XPath expression to extract the value of attributes from
        the XML file being dumped. Only applies when dumping the manifest.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值