10

I am trying to remove the log statements without success. Other SO answers to the same question refer to Eclipse or to an old Android Studio IDE (Intellij).

build.gradle

buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } ... 

proguard-rules.pro

-assumenosideeffects class android.util.Log { public static *** d(...); public static *** v(...); public static *** i(...); public static *** w(...); public static *** e(...); } 

I can still see the log statements after getting the source code from the signed app-release.apk

1 Answer 1

13

a change in the build.gradle, replacing the default proguard-android.txt with proguard-android-optimize.txt did the trick.

buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } ... 

Note: the default proguard setting in gradle is proguard-android.txt

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

4 Comments

This really saved my day! This is actually mentioned here (indirectly): developer.android.com/studio/build/shrink-code.html#shrink-code
after using proguard-android-optimize.txt i am getting error - java.lang.IllegalArgumentException: Form-encoded method must contain at least one @Field.
What was your change?? This code looks exactly the same as the question....
@JohnathanLogan 'proguard-android.txt' to 'proguard-android-optimize.txt'

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.