proguard 不会删除日志

2024-05-08

In proguard-rules.pro,我有以下配置:

-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(...);
}

In my 梯度构建,我启用proguard仅适用于release build:

buildTypes {
        debug {
            debuggable true
            minifyEnabled false
            signingConfig signingConfigs.debug
        }
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

在 MyActivity 中,我有日志代码:

public class MyActivity extends Activity {
   @Override
    public void onResume() {
        super.onResume();
        Log.d("myTag", "Hello!");
    }
    ...

}

我在发布版本中运行我的应用程序:

在logcat中,我仍然看到日志“Hello!”,为什么我的proguard配置没有删除日志?


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

proguard 不会删除日志 的相关文章

随机推荐