How to tell if Proguard has done its job

前端 未结 2 1805
长情又很酷
长情又很酷 2020-12-13 14:39

I downloaded proguard encapsulated in a zip file and unpacked it onto my hard disk. I did not install it in any way (because I didn\'t know how). I then added

相关标签:
2条回答
  • 2020-12-13 15:00

    Normally the size will indicate whether ProGuard has worked but you can :-

    1. Use Dex2Jar to convert the apk to a jar file
    2. Open the resulting Jar file with Jd-Gui to view the code it contains
    0 讨论(0)
  • 2020-12-13 15:09

    An alternative to @Kuffs method would be to compare your new APK with an old one. Open them both up (with 7zip or your preferred tool) and compare the size of the classes.dex files in each of them.

    A few straightforward reasons you might not be seeing much of a size saving:

    • The unobfuscated classes.dex was able to be compressed much more than the obfuscated one. This is always true to some extent.
    • You didn't do a release build. Proguard only gets run on release builds since debugging obfuscated code is a nightmare.
    • The Proguard settings you're using aren't doing much good (at least in terms of code size) for your project. I've actually seen proguard's code inlining settings increase the size of jar files before!
    0 讨论(0)
提交回复
热议问题