Android查看应用方法数-65536限制

前言

当一个项目快速迭代时,难免引进各种依赖,从而导致单个apk超过65k的限制。如何查询apk的方法数也是每个Android Developer必备技能。

我使用的是dex-method-counts,这里跟大家分享一下它的使用。


下载&&编译

下载dex-method-counts到本地

git clone https://github.com/mihaip/dex-method-counts.git

编译

cd dex-method-counts
./gradlew assemble

使用

为了方便大家使用dex-method-counts,建议大家将路径添加到PATH变量中,Mac和Ubuntu使用者可以参考我的配置:

#Add dex-method-counts
PATH=/Users/wangzhengyi/Repositories/github/dex-method-counts:$PATH

添加到PATH之后,我们就可以直接查询apk的方法数了:

dex-method-counts path\to\App.apk

参考输出如下:

Read in 65490 method IDs.
<root>: 65490
    : 3
    android: 6837
        accessibilityservice: 6
        bluetooth: 2
        content: 248
            pm: 22
            res: 45
        ...
    com: 53881
        adjust: 283
            sdk: 283
        codebutler: 65
            android_websockets: 65
        ...
    Overall method count: 65490

猜你喜欢

转载自blog.csdn.net/zinss26914/article/details/76295530