Ole Tetzschner
Ole Tetzschner

Reputation: 91

Proguard in Android Studio are not removing logging

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.**

Upvotes: 2

Views: 1822

Answers (2)

Ole Tetzschner
Ole Tetzschner

Reputation: 91

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'

Upvotes: 1

marshallino16
marshallino16

Reputation: 2671

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

Upvotes: 0

Related Questions