I want to create an obfuscated android application. I use ProGuard for that. I would like to automatically remove all the Log.* messages. How can I do that? I found this post but I still get them. (I use a decompiler to check the obfuscation).
The proguard-project.txt is the following:
-injars libs/In.jar -outjars libs/Out.jar #-libraryjars <java.home>/lib/rt.jar -libraryjars C:/Users/thomas/android-sdks/platforms/android-7/android.jar -dontpreverify -repackageclasses '' -allowaccessmodification -optimizations !code/simplification/arithmetic -renamesourcefileattribute SourceFile -keepattributes Exceptions,InnerClasses,Signature,Deprecated, SourceFile,LineNumberTable,*Annotation*,EnclosingMethod -keep public class * { public protected *; } -keepclassmembernames class * { java.lang.Class class$(java.lang.String); java.lang.Class class$(java.lang.String, boolean); } -keepclasseswithmembernames class * { native <methods>; } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve(); } -assumenosideeffects class android.util.Log { public static *** d(...); public static *** e(...); }
Any help would be appreciated.
Thanks.
This only remove all debug Log.d(TAG, "...");
and error Log.e(TAG, "...")
calls:
-assumenosideeffects class android.util.Log { public static *** d(...); public static *** e(...); }
To remove all log calls, simply use this:
-assumenosideeffects class android.util.Log { *; }
The default android Proguard configuration disables optimisation. To enable it, in your project's project.properties file use proguard-android-optimize.txt instead of proguard-android.txt
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