Skip to content Skip to sidebar Skip to footer

How To Config My Proguard-project.txt File To Remove Just Logs

This is the code i am using right now in the proguard-project.txt # This is a configuration file for ProGuard. # http://proguard.sourceforge.net/index.html#manual/usage.html -dont

Solution 1:

The ProGuard configuration file is split into several parts (as of Android SDK r20), which are specified in project.properties:

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

You can only remove logging if optimization is not disabled, which requires a different global configuration file:

proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt

The file proguard-project.txt only needs to contain project-specific configuration. Your file seems to contain way too much, but these are the setttings to remove the logging:

-assumenosideeffects classandroid.util.Log {
    publicstaticbooleanisLoggable(java.lang.String, int);
    publicstaticintv(...);
    publicstaticinti(...);
    publicstaticintw(...);
    publicstaticintd(...);
    publicstaticinte(...);
}

Similar questions and answers:

Solution 2:

If you're stuck with this on Android Studio, the solution of Eric must be applied to your build.grade file (at the app level). Replace:

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

with:

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

Post a Comment for "How To Config My Proguard-project.txt File To Remove Just Logs"