According to Google, I must “deactivate any calls to Log methods in the source code” before publishing my Android app. Extract from section 5 of the publication checklist:
Make sure you deactivate logging and disable the debugging option before you build your application for release. You can deactivate logging by removing calls to Log methods in your source files.
My open-source project is large and it is a pain to do it manually every time I release. Additionally, removing a Log line is potentially tricky, for instance:
if(condition) Log.d(LOG_TAG, "Something"); data.load(); data.show();
If I comment the Log line, then the condition applies to the next line, and chances are load() is not called. Are such situations rare enough that I can decide it should not exist?
This is on the official checklist, so I guess many people do this on a regular basis.
So, how to efficiently but safely remove all Log lines?