- 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 1,401 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
6
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
- 10,102
- 12
- 51
- 64
5
You can use Ctrl+Shift+F and then type in "Log.d(", that will show you the places where it's being used.
AskNilesh
- 67,701
- 16
- 123
- 163
Usman Rafi
- 316
- 1
- 2
- 12
3
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.
Niki van Stein
- 10,564
- 3
- 29
- 62