How to obfuscate my project using ProGuard tool? - android

I am wondering about how to obfuscate the Android application using ProGuard tool.
I've read info from http://android-sdk.appspot.com/guide/developing/tools/proguard.html.
But no luck still. I've set to enable configuration for ProGuard tool in default.properties file added following line:
proguard.config=proguard.cfg
Then build the project. And was looking to generate "mapping.txt". But not generated.
Can you suggest me where I am wrong ?
Thanks in advance.

ProGuard only runs when making external builds, not internal development builds. Use File->Export->Android->Export Android Application

ProGuard is only integrated in the Android build process as of the Android 2.2 SDK. You may have to update to the latest SDK and then update the project with "android update project".
Furthermore, ProGuard is only applied in release builds: "ant release".

Your doing nothing wrong. In addition to setting the config file as you indicated you might also need to set debuggable=false in the android manifest.

Related

Android Dexguard: How to integrate?

I am trying to use Dexguard in order to obfuscate my simple Android Application.
I have followed the integration steps, I.e. adding the jar file into the libs folder in Eclipse.
However, Dexguard does not seem to be integrated into my application.
How do I know if Dexguard has been Integrated?
Is there any additional steps that I need to make?
You actually need to put the DexGuard plugin in the dropins directory in Eclipse. You can find all the necessary details in the DexGuard manual > Eclipse plugin.

Enable proguard automatically while creating new project in Android

Many times after building an app and uploading it to play store I realize that I haven't guarded the apk using proguard feature provided by android and anyone can decompile the app using various tools to get my app's source code. So is it possible that whenever i create a new project the proguard feature is automatically enabled and my app's source code can be secure?
For obfuscation just add to project.properties file in android project the following line:
proguard.config=proguard.cfg
see details in android's development page here
Probably you will have to right a custom ant build script which throws an error when proguard property is not set in properties.To write custom ant build script visit this link:
http://www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html

Proguard Enabling in eclipse

I would like to use proguard in my application. Can anyone tell me the steps should I follow to create the cfg file. Like what is the first step I have to do, where should I create the file..etc
On Android Developer's site there is a great documentation:
http://developer.android.com/tools/help/proguard.html
In short:
In your project directory find project.properties file. You should have similar line:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt
In txt files you should have proguard configuration.
You should know one thing that proguard is disable (by default) if you run application in debug mode. Proguard will "start" while exporting signed app.

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
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.
Make sure that you are using the latest Android SDK. You can check this with the standard android application from the SDK.
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.
You can then enable ProGuard by uncommenting the proper line in project.properties.

Proguard is not Doing Anything

I've set up proguard according to this link: http://android-developers.blogspot.com/2010/09/proguard-android-and-licensing-server.html
When I build with Ant I get no errors or warnings, but I also don't get any verbose output telling me that ProGuard is doing anything. By other means I'm able to tell that the apk is not being obfuscated.
All of my code, with the exception of the Activity class is in a library (as source files). I've read that the activity class will not obfuscated, but I'm wondering if I have to set up something different in my build files to include the library files?
Did you remove the debug line from your manifest?
This is a very old link.
Assuming you've downloaded the ADT plugin and the SDK this year, Proguard is bundled in the build process.
All you have to do is add this to default.properties:
proguard.config=proguard.cfg
Note that the obfuscation will occur only when you export a final version and not on every build.

Categories

Resources