I have try many solution e.g. Remove all debug logging calls before publishing: are there tools to do this?
However, When I look in to the logcat. The log still shows. Log from my app is gone but the log from third-party still exist.
This is my proguard config.
-dontwarn **
-target 1.7
#-dontusemixedcaseclassnames
#-dontskipnonpubliclibraryclasses
#-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!code/allocation/variable
-keep class **
-keepclassmembers class *{*;}
-keepattributes *
-dontskipnonpubliclibraryclasses
#-dontobfuscate
-forceprocessing
-optimizationpasses 5
-keep class * extends android.app.Activity
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
This is my gradle file config
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable false
jniDebuggable false
signingConfig signingConfigs.config
}
debug {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
minifyEnabled true
debuggable false
zipAlignEnabled true
jniDebuggable false
}
}
The customer want to remove every log even the log from Third-party library or SDK for security reason
ProGuard will only be able to remove logging calls in application code, i.e. code that is being processed and included in your own application. Any logging calls being performed by the Android runtime cannot be removed because the runtime is installed on each device and cannot be modified in advance obviously.
Looking at your rules and gradle file, the setup looks correct and also works for me to remove calls to android.util.Log
. Ensure that you are using a recent version of ProGuard (e.g. 5.2.1 or later). Also you have ProGuard still disabled in your release
buildType, you will need to set minifyEnabled
to true
to enable it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With