- I have used many logs in project which i want to remove
- Is there a way to find all the
Log.d()lines in android studio using a find method
Asked
Active
Viewed 953 times
3
-
right click the function => is there a context menu entry called "find usage of"? – Philipp Sander Mar 15 '19 at 14:15
-
also, why remove logs?! wouldn't adapting the log-level be better? – Philipp Sander Mar 15 '19 at 14:16
3 Answers
5
Bring up "Find in Path" using
Edit > Find > Find In Path...(ctrl + shift + F)Search for
Log.din the search box. You can limit the files to search for using theFile maskoption in the top right e.g. to limit your search to.javafiles.Press ctrl + enter. This will now show your results in the Search panel.
Alternatively, use an alternative logging library such as Timber that won't dump out debug logs in user builds.
Michael Dodd
- 9,667
- 12
- 50
- 64
4
You can use Ctrl+Shift+F and then type in "Log.d(", that will show you the places where it's being used.
AskNilesh
- 63,753
- 16
- 113
- 150
Usman Rafi
- 308
- 1
- 2
- 12
2
Instead of removing all Log.d() calls manually you can edit your proguard-rules.pro file to include the following lines:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
}
It will make the functions Log.d() and Log.v() empty, generating no logs in your release apk.
Bas van Stein
- 10,298
- 3
- 25
- 62