Short of diligently commenting out the numerous Log.v() and Log.d() statements I planted throughout an app I have written, is there a more elegant/efficient way of compiling an app to a "release mode", so that my LogCat messages don't show up?
Asked
Active
Viewed 1.2k times
2 Answers
1
Using the latest Android Studio 2.1.3 at this moment, I followed the steps below:
Add the lines below in proguard-rules.pro
-assumenosideeffects class android.util.Log {
*;
}
Edited build.gradle of app module. minifyEnabled has to be set to true to activate proguard. proguard-android-optimize.txt has to be used, in order to allow optimisations in proguard-rules.pro to run.
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}

ChinLoong
- 1,735
- 24
- 26
-
1In comments to accepted answer (http://stackoverflow.com/questions/2446248/remove-all-debug-logging-calls-before-publishing-are-there-tools-to-do-this) it is said that line numbers will be broken as Log calls will be removed. – CoolMind Feb 03 '17 at 12:10