Remove Logging with Proguard

假装没事ソ 提交于 2019-12-03 13:00:13

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/29214623/remove-logging-with-proguard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!