25

Reading the docs on proguard . . . android docs

I'm supposed to have a ProGuard.cfg as it says... "When you create an Android project, a proguard.cfg file is automatically generated in the root directory of the project. "

If I google the issue there are answers all over the place most of them saying to modify a file that starts with a warning not to modify the file.

Are the docs out of date? How to I get this enabled for release builds? thanks, Gary

Dean Blakely
  • 3,535
  • 11
  • 51
  • 83

2 Answers2

55

If you're using ADT 17 or newer, the documentation is slightly inaccurate. The generated file is proguard-project.txt and will be in the root directory of your project.

To enable Proguard, you will need to ignore the "do not modify" warning in project.properties and uncomment the following line:

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

The Android toolchain will sometimes make changes to project.properties, but your Proguard path will be preserved.

acj
  • 4,821
  • 4
  • 34
  • 49
  • 3
    Thanks. How can I examine my release .apk to tell if ProGuard did it's job? – Dean Blakely Jan 25 '13 at 16:06
  • 4
    Proguard produces a set of .txt files (e.g., `usage.txt`) in your project directory that tell you which files were removed, which ones were left untouched, etc. There's some helpful verification info in this post: http://stackoverflow.com/questions/7153048/android-code-obfuscation-with-proguard-how-does-one-know-its-been-obfuscated – acj Jan 25 '13 at 16:14
  • @acj uncomment this line, is all you have to do to enable Proguard? – AlexAndro Oct 04 '13 at 09:19
  • 1
    @AlexAndro Yes. The Android tools should handle the rest. – acj Oct 04 '13 at 12:46
  • I removed # from `project.properties` before the line you mentioned. I restarted the eclipse and rebuild my project but there is no `proguard-project.txt` in my root folder now. – Bob Jan 11 '15 at 07:31
  • @breceivemail : Your proguard txt file path might be missing in project.properties file. – Manish Agrawal Aug 05 '15 at 10:43
0

In my case, the entire Proguard folder was missing at the location specified in the error. Make sure that the folder is present.