3

I want to remove all the Log statements that I had added when I was making my android project. This is because I am now shipping the final project to my client.

Is there a shortcut which will automatically find all the Log statements and delete them?

This would spare the labor of going to individual Log statements and then deleting them.

forsvarir
  • 10,749
  • 6
  • 46
  • 77
user743883
  • 107
  • 1
  • 7
  • In short, no. In fact, you've probably wasted more time looking for a "non-labor-intensive" solution than you would have if you'd just done a "find references" search. – Stephen C May 23 '11 at 09:26
  • In addition, as someone here on SOF said (sorry, can't find it now), `verbose` and `debug` logs are not compiled in release mode, so you can let them be. – ernazm May 23 '11 at 09:31

3 Answers3

6

Use Eclipse, type android.util.Log, place your cursor on the word Log, and press ctrl+shift+g or cmd+shift+g to find all references to it.

Randy Sugianto 'Yuku'
  • 71,383
  • 57
  • 178
  • 228
4

Yes, you can use ProGuard to strip them automatically. See Remove all debug logging calls before publishing: are there tools to do this?

Community
  • 1
  • 1
Graham Borland
  • 60,055
  • 21
  • 138
  • 179
0

build.gradle

buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' }

proguard-rules.pro

-assumenosideeffects class android.util.Log { *; }

Titto Jose
  • 72
  • 1
  • 3