Skip to content

Instantly share code, notes, and snippets.

@adrbtk
Last active May 28, 2021 11:00
Show Gist options
  • Save adrbtk/c8cb0381e7ce2283a77e2cc80aba40d3 to your computer and use it in GitHub Desktop.
Save adrbtk/c8cb0381e7ce2283a77e2cc80aba40d3 to your computer and use it in GitHub Desktop.
Configure removing of logging in android release build
  1. Add next lines to the file proguard-rules.pro
-optimizations code/removal/*
-assumenosideeffects class android.util.Log {
    public static boolean isLoggable(java.lang.String, int);
    public static int v(...);
    public static int d(...);
    public static int i(...);
    public static int w(...);
}
-assumenosideeffects class java.lang.Exception {
    public void printStackTrace();
}

-assumenosideeffects class timber.log.Timber* {
    public static *** v(...);
}
-assumenosideeffects class * implements org.slf4j.Logger {
    public void trace(...);
}
  1. Change in build.gradle file with ending -optimize
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment