2

Using Android Studio 1.2 beta, Proguard 4.7, I'm not able to optimize (remove) Log.d.

Using the tools d2j-dex2jar and jd-gui I can see that all the Log.d remains in the apk.

Any wise comments on this problem?

The proguard-rules.pro are used because the -dontwarn are working.

My proguard-rules.pro:

-assumenosideeffects class android.util.Log { public static *** v(...); public static *** i(...); public static *** w(...); public static *** d(...); public static *** e(...); } -dontwarn com.google.common.** -dontwarn javax.annotation.** -dontwarn javax.inject.** -dontwarn sun.misc.Unsafe -dontwarn org.joda.time.** 

2 Answers 2

1

From How to config my proguard-project.txt file to remove just Logs

Replace: proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

with: proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

Sign up to request clarification or add additional context in comments.

2 Comments

Doing this seems risky. Check the comment on top of the file at android.googlesource.com/platform/sdk/+/master/files/….
There are other approach of removing debug messages, do check out this blogpost medium.com/@elye.project/…
0

This worked for me

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

1 Comment

copy-pasted your setup, but it is still not working :( Have you tried to reverse-engineered your apk to verify that Log is removed?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.