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.**
Ole Tetzschner
  • 91
  • 1
  • 3
  • 9

2 Answers2

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'

Community
  • 1
  • 1
Ole Tetzschner
  • 91
  • 1
  • 3
  • 9
  • Doing this seems risky. Check the comment on top of the file at https://android.googlesource.com/platform/sdk/+/master/files/proguard-android-optimize.txt. – Elye Jul 07 '16 at 06:29
  • There are other approach of removing debug messages, do check out this blogpost https://medium.com/@elye.project/debug-messages-your-responsible-to-clear-it-before-release-1a0f872d66f#.6io15cj29 – Elye Jul 07 '16 at 06:29
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(...);
}
marshallino16
  • 2,645
  • 15
  • 29
  • copy-pasted your setup, but it is still not working :( Have you tried to reverse-engineered your apk to verify that Log is removed? – Ole Tetzschner Apr 10 '15 at 10:19