Removing ActionbarSherlock Logs When BuildConfig.DEBUG

I noticed that the ActionBarSherlock library displays a lot of debugging information in my application, simply because there are many lines like this:

if (BuildConfig.DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu); 

Fortunately, the log is only displayed on my debug device. Thanks to the if .
The big problem is that I would like to delete the entire log on the debugging device in order to focus on my code.

I know 2 solutions to avoid this:

  • Delete / edit all logs in the library
  • Filter the logarithm to Eclipse.

Is there an easier way to achieve this and "fake" the library by saying that we are not on the debugging device? I really would like to avoid the 2 above solutions.

+6
source share
2 answers

Open the ActionBarSherlock project
Open file /gen/com/actionbarsherlock/BuildConfig.java
And set DEBUG = false

+4
source

Debug messages will be displayed only if the application is running in debug mode. This means that if you have not decided on AndroidManifest.xml, it will only be displayed in debug builds.

Once you create the assembly, it will not appear.

You can verify this by manually setting the debuggable flag in your androidmanifest file and running it. Also see http://developer.android.com/guide/topics/manifest/application-element.html for details on options in the manifest file.

However, this probably will not help you, because your application will not work in debug mode, and you will not be able to connect the debugger.

You can replace the entire link to BuildConfig.DEBUG with something like your.package.name.SherlockConfig.DEBUG and define a debug variable there. this way you can enable and disable debugging of ActionbarSherlock yourself.

0
source

Source: https://habr.com/ru/post/945923/


All Articles