android去掉所有log日志,Android两步去掉Release版本Log日志

在APP项目的release配置中开启混淆配置,已经开启的就不用管了:

buildTypes {

debug {

}

release {

// Enables code shrinking, obfuscation, and optimization for only

// your project's release build type.

minifyEnabled true

// Enables resource shrinking, which is performed by the

// Android Gradle plugin.

shrinkResources true

// Includes the default ProGuard rules files that are packaged with

// the Android Gradle plugin. To learn more, go to the section about

// R8 configuration files.

proguardFiles getDefaultProguardFile(

'proguard-android-optimize.txt'),

'proguard-rules.pro'

}

....

在代码混淆配置proguard-rules.pro添加下面的代码:

#-------------- 去掉所有打印 -------------

-assumenosideeffects class android.util.Log {

public static ***

你可能感兴趣的:(android去掉所有log日志,Android两步去掉Release版本Log日志)