Debug-only methods or interface in Java/Android
<p>I'm a newbie to Android and Java--lots of experience with C/C++/C#.</p>

<p>I have in interface that looks like this:</p>

<pre><code>class WellNamedClass {
    void greatMethodToCallWhenever() { /*...*/ }

    void debugOnlyMethod() { /*...*/ }
}
</code></pre>

<p>In the the languages mentioned above, I would either #ifdef the entire debugOnlyMethod method out or #ifdef the implementation out so it simply does nothing, but Java doesn't have a preprocessor.</p>

<p>I'm totally comfortable with having the code there and checking at run-time whether we are in a debug build, but I can't even find a way of doing that.</p>

<p>I've found suggestions like <a href="http://stackoverflow.com/questions/32041/how-to-remove-debug-statements-from-production-code-in-java">this one</a> where you create a class with a constant indicating whether debug (or whatever else you want) is enabled. This could work, but then you have to manually change code to get a debug vs. a release build.</p>

<p>Has anyone else solved this problem? Thanks.</p>
