Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell if Proguard has done its job

Tags:

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 proguard.config=proguard.cfg to my project.properties file. I then did an "export android application" fully expecting eclipse to complain that it didn't know where my proguard installation was, but there was no complaint. Indeed a new apk file appeared in my keystore, and a set of files (dump.txt etc) appeared in my app's proguard subdirectory. The mapping.txt looks like a nice list of mappings from my long variable names to one and two letter variables. This should all be strong evidence that proguard has somehow worked - my only concern is that the apk is scarcely any smaller than it was before. Is there any way to check that the apk includes proguard's obfuscations?

like image 987
Mick Avatar asked Apr 17 '12 12:04

Mick


People also ask

How do you test ProGuard rules?

In Android Studio 4.1 you can do this by going to Build > Analyze APK and then selecting your APK that should have had Proguard run with it. You can then inspect the classes. dex file and check its contents. You can see which classes have been obfuscated and removed by directly traversing the file structure.

How does ProGuard obfuscation work?

In the obfuscation step, ProGuard renames classes and class members that are not entry points. In this entire process, keeping the entry points ensures that they can still be accessed by their original names. The preverification step is the only step that doesn't have to know the entry points.


1 Answers

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
like image 151
Kuffs Avatar answered Nov 25 '22 02:11

Kuffs