Android remove log in release

Follow below steps while using proguard android to remove log

Function format and meaning of the android console log are as below:

Log.e(String, String) (error)
Log.w(String, String) (warning)
Log.i(String, String) (information)
Log.d(String, String) (debug)
Log.v(String, String) (verbose)


1) Add following to your proguard-rules.pro file to remove android log

# Remove all log android
-assumenosideeffects class android.util.Log {
    public static *** e(...);
    public static *** w(...);
    public static *** wtf(...);
    public static *** d(...);
    public static *** v(...);
    public static *** i(...);
}



2) To remove log android release use build.gradle (Module: app) file section buildTypes =>release

set minifyEnabled true
proguardFiles  - set proguard file


buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

No comments:

Post a Comment

Popular Posts