2

Since ADT 17 you can find in the gen folder a BuildConfig class with a DEBUG constant. I often use this constant in my code, since ADT changes the value automatically when you export the application.

However with Proguard this doesn't work anymore. E.g. I have following snippet:

if (!BuildConfig.DEBUG) {
    ACRA.init(this);
}

Proguard notices, that DEBUG is true, so it removes this snippet completely and shrinks the app. After that ADT changes DEBUG constant, but this is too late.

The only solution I know is to create my own DEBUG constant and to change it manually again. But I really like the functionality of ADT. Do you know a better solution?

Thanks in advance.

Edit:

There is a workaround. Create your own DEBUG constant, which is initialized at runtime:

debug = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));

I create this variable at the very first in the onCreate method of my Application class. That is a workaround, which works, but it isn't the solution of the problem.

vRallev
  • 4,982
  • 3
  • 31
  • 34
  • Its not ProGuard, BuildConfig.DEBUG isn't getting set to false. http://stackoverflow.com/questions/9855834/when-does-adt-set-buildconfig-debug-to-false – smith324 Mar 24 '12 at 21:39

0 Answers0