3

I have a wrapper class for making log calls during development. This makes it easy to turn all logging on or off at any given time (plus some other nifty features). Previously I used a specific ProGuard optimization to remove this class during release, which also removed the calls to the class's static methods (so no log strings were left behind).

Unfortunately because of this, I have to disable ProGuard's optimization feature. While I can easily turn off the logging, all of my log strings are still visible in the resulting apk, and unless I'm missing something, there is no other way in ProGuard to remove them.

Is there any other way to remove these strings when building a release package in the Eclipse GUI? (not ANT)

Community
  • 1
  • 1
wirbly
  • 2,183
  • 1
  • 24
  • 24

1 Answers1

0

I don't know where you string literals are etc. but to simulate a ifdef debug statement you would do something similar to this which may be trivial if you can just wrap all the affected inner class/method/var's of your debugging class in such a statement.

Apparently the compiler removes anything it finds in that block as more or less dead code, or so I have read, never checked it out though.

Community
  • 1
  • 1
Idistic
  • 6,281
  • 2
  • 28
  • 38
  • The strings are actually in the call to the logging method: `Logger.print("doing something here");` so unfortunately disabling logging inside the `Logger` class will still leave the strings scattered throughout the project. (That was the great thing about the ProGuard method - it actually removed all of the calls as well) – wirbly Jul 21 '11 at 02:22
  • @wirbly, so basically a lot of if { adds, well maybe someone will come up without something else, it's all I can think of sans ProGuard – Idistic Jul 21 '11 at 02:49