有没有办法让数的方法在一个jar文件中使用的计数 [英] Is there a way to get count of number methods used in a jar file

查看:105
本文介绍了有没有办法让数的方法在一个jar文件中使用的计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在一个jar文件中使用的所有方法计数。 我的APK使用某些外部罐和有许多类周围百为precise

Can i have the count of all methods used in a jar file . My APK uses certain external JARS and there are a number of classes around hundred to be precise.

我已经使用像dex2jar JAD和其他反编译仅举几例,但他们都似乎表明只有在特定的类文件中的方法。

I have used decompilers like dex2jar JAD and others to name a few ,but they all seem to show methods only in particular class file.

有没有一种方法,我可以得到一个总数?

Is there a way i can get a total count ?

推荐答案

您可以罐子转换为DEX文件,然后拉的方法引用数出了头。它被存储为一个无符号小尾数整数,偏移量为88(将0x58)。

You can convert the jar to a dex file, and then pull the number of method references out of the header. It is stored as an unsigned little endian integer, at offset 88 (0x58).

dx --dex --output=temp.dex orig.jar
cat temp.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'

请记住,这是唯一的方法数引用,而不是方法引用的次数。换句话说,如果在地塞米松文件被引用两次一个特定的方法,它只会被一次在在头部的计算。而当你把这个罐子到您的APK,该方法引用的是常见的,两者之间的重复数据删除,因此最终合并的apk的总的方法引用计数将< =两者之和

Keep in mind that this is the number of unique methods referenced, not the number of method references. In other words, if a particular method is referenced twice in the dex file, it will only be counted once in the count in the header. And when you import this jar into your apk, the method references that are common between the two are deduplicated, so the total method reference count of the final merged apk will be <= the sum of the two.

这篇关于有没有办法让数的方法在一个jar文件中使用的计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆