Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Logging with Proguard

I am trying to remove the log statements without success. Other SO answers to the same question refer to Eclipse or to an old Android Studio IDE (Intellij).

build.gradle

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

proguard-rules.pro

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

I can still see the log statements after getting the source code from the signed app-release.apk

like image 801
momo Avatar asked Mar 23 '15 15:03

momo


1 Answers

a change in the build.gradle, replacing the default proguard-android.txt with proguard-android-optimize.txt did the trick.

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

Note: the default proguard setting in gradle is proguard-android.txt

like image 70
momo Avatar answered Nov 05 '22 20:11

momo