Pableras84
Pableras84

Reputation: 1195

How to use ProGuard with an android api 4 (android 1.6)?

First of all, i'm new on ProGuard, but i read some tutorials and i know that the best way to use it on android is the one described on android.developer guide.

im trying to obfuscate the code of my new Android app with ProGuard. For that i enter this website: http://developer.android.com/tools/help/proguard.html#enabling

But it tells: "hen you create an Android project, a proguard.cfg file is automatically generated in the root directory of the project."

That file does not exist on my project root directory, so i dont know how to continue. My Android app is for api level 4, 1.6, so, is it possible that this is a problem for using ProGuard?

How can i use proguard with an app for api 4 (android 1.6)

Thanks a lot

Upvotes: 0

Views: 583

Answers (2)

Eric Lafortune
Eric Lafortune

Reputation: 45676

  1. Make sure that you are using the latest Android SDK. You can check this with the standard android application from the SDK.

  2. Then make sure that your project directory is up-to-date too, by typing

    adb update project -p MyProjectDirectory
    

    (from the command-line, with the proper path to the directory of your project). This should create a ProGuard configuration file, which is called proguard-project.txt in recent releases of the SDK.

  3. You can then enable ProGuard by uncommenting the proper line in project.properties.

Upvotes: 1

r-hold
r-hold

Reputation: 1120

You need a proguard.cfg File. You can either create it by hand or use the proguard-GUI (> java -jar proguardgui.jar). Using the GUI makes some things easier, but a basic understandig of proguard and obfuscating is still required. It isn't very comfortable to use the gui for obfuscating your release apk, so proviging the config-file and using the SDKs Build tools is still the best way to go.

The ACRA Documentation features an Example for a proguard.cfg http://code.google.com/p/acra/wiki/ACRAProGuardHowTo most of the stuff is ACRA related and can be ommited if you don't use ACRA in your project.

I Don't know if the SDK is supposed to create an proguard.cfg. If never seen one which was created automaticaly, so i suggest you go with the file as supplied by the acra-guys for a starting point.

Upvotes: 1

Related Questions