Richard Ye
Richard Ye

Reputation: 191

How to obfuscate an APK in Android 2.1/2.2

We know in SDK 2.3 we can obfuscate APK with Proguard.

The question is: How to obfuscate APK in Andorid 2.1/2.2 SDK?

Upvotes: 2

Views: 2762

Answers (2)

j2emanue
j2emanue

Reputation: 62559

if you want to verify if the code was obfuscated do this: download:

1. dex translator tool - http://code.google.com/p/dex2jar/

then this tool to view the classes: JDGUI- http://java.decompiler.free.fr/?q=jdgui

2. after you install dex2jar unzip it etc and remember the folder its in. open up the apk file using winzip or winrar. You'll see a file there called classes.dex copy that file into the same folder that dex2jar is in (the dex translator tool you just downloaded).

3. In the same folder click on setclasspath.bat

Open up a command prompt and traverse to the same folder that dex translator is in and run: dex2jar classes.dex

-another file shows up now. Open up JDGUI and open up the file that got generated its called classes_dex2jar.jar ....

4. you can observe if the decompiled code is obfuscated(readable) now.

Upvotes: 1

Addev
Addev

Reputation: 32273

Edit the file (in the project root) project.propierties and add the line

proguard.config=proguard.cfg

And its done. When you try to generate the signed apk of your app it will take a little longer and it will be obfuscated.

If you receive the "Conversion to dalvik error" when generating the apk you need to update the proguard of your sdk. For doing it you need to go to the ProGuard page to the download section. Download the last stable version and put it content in

SDK_ROOT/tools/proguard

Deleting the existing content before of course.

You can check the Proguard manual at their page (link is above) and the Android's Proguard page for more info about ProGuard

Upvotes: 3

Related Questions