Jonny
Jonny

Reputation: 306

Android gradle remove log

I've created an application in android in release mode. I want to remove all the logs in my project when i'm publishing my app in release mode. how can i do it without duplicating my code? can i remove the log using Gradle ?

Upvotes: 2

Views: 1173

Answers (1)

chethanks
chethanks

Reputation: 47

You can make use of BuildConfig.DEBUG variable, which will be true for debug builds and false otherwise.

You could have a Constants file with a variable like

public static final LOG_ENABLED = BuildConfig.DEBUG;

then check the variable before you print a log.

if(Constants.LOG_ENABLED){
   // print Log
}

Upvotes: 1

Related Questions