1

I am using Proguard in my application, After exporting build i have performed reverse engineering on it with help of dex2jar, but some java class names are still in readable format but method names are obfuscated. e.g. If i having class named as TestClass.java before obfuscation after obfuscation it expect something like a.java or b.java...

But it appears as TestClass.java for Activity classes in my project.

Do anybody having any idea where i am wrong that Activity classes names are in readable format ?

Thanks in Advance!

Manish Lomte
  • 329
  • 4
  • 17

2 Answers2

0

ProGuard is integrated into the Android build system, so you do not have to invoke it manually. ProGuard runs only when you build your application in release mode, so you do not have to deal with obfuscated code when you build your application in debug mode. Having ProGuard run is completely optional, but highly recommended.

When you build your application in release mode, either by running ant release or by using the Export Wizard in Eclipse, the build system automatically checks to see if the proguard.config property is set. If it is, ProGuard automatically processes the application's bytecode before packaging everything into an .apk file. Building in debug mode does not invoke ProGuard, because it makes debugging more cumbersome.

http://developer.android.com/tools/help/proguard.html.

The above quote is from the documentation. Is your application in release mode?

http://developer.android.com/tools/publishing/app-signing.html#releasemode

Edit:

What is obfuscation?

By default, compiled bytecode still contains a lot of debugging information: source file names, line numbers, field names, method names, argument names, variable names, etc. This information makes it straightforward to decompile the bytecode and reverse-engineer entire programs. Sometimes, this is not desirable. Obfuscators such as ProGuard can remove the debugging information and replace all names by meaningless character sequences, making it much harder to reverse-engineer the code. It further compacts the code as a bonus. The program remains functionally equivalent, except for the class names, method names, and line numbers given in exception stack traces.

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • Thanks Raghunandan, but my question is Why are names of my Activity classes have not changed. – Manish Lomte Apr 15 '13 at 04:48
  • Did you unzip your apk after enabling your proguard in release mode and check? Check the contents of the .apk file and then come to conclusion – Raghunandan Apr 15 '13 at 04:50
  • Yes i unzipped my apk using dex2jar and analyze the classes it creates many pakages like a,b,c but creates my.package.name which contains Activity classes only and Names of the classes are readable but method names and logic is obfuscated. Is there any limitation of proguard that not to obfuscate Activity class name ? – Manish Lomte Apr 15 '13 at 04:57
  • You can check the details of proguard here http://proguard.sourceforge.net/. Check the edit – Raghunandan Apr 15 '13 at 05:00
  • According to this post - http://stackoverflow.com/questions/9614402/questions-about-proguard. Then the activities package must be fully retained because any activity classes will not be obfuscated. Also com.mycompay.myapp must be retain for any item referenced from XML so the system can correctly find your entry as defined in the manifest. Is this the limitation that Activity name not changed – Manish Lomte Apr 15 '13 at 05:07
  • That's because it does not change entry in the manifest file. Check if the activity name changes in manifest file also. Supposes you class name is obfuscated but you cannot modify xml resources at runtime. So you will get a activitynotfound exception coz it won't find the right activity name in manifest. – Raghunandan Apr 15 '13 at 05:10
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/28225/discussion-between-raghunandan-and-manishl) – Raghunandan Apr 15 '13 at 05:34
0

Because in \sdk\tools\proguard\proguar-android file, written something like this -keep public class * extends android.app.Activity so it means that when proguard runs, these classes will keep their CustomNames. Otherwise programm can not find your class