Title: proguard doesn't remove logs
Tags: android;proguard;android-proguard
Question: In proguard-rules.pro, I have following configuration:
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int d(...);
public static int i(...);
In my gradle build, I enable proguard only for release build:
buildTypes {
debug {
debuggable true
minifyEnabled false
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
In MyActivity, I have log code:
public class MyActivity extends Activity {
@Override
public void onResume() {
super.onResume();
Log.d("myTag", "Hello!");
...
I run my app in release build:
In logcat, I still see the log "Hello!", Why my proguard configuration doesn't remove logs?
Comment: you shoud use   proguardFiles getDefaultProguardFile('proguard-android-optimize.txt').

Comment: see this hope it help you https://stackoverflow.com/a/21827596/9130109

Comment: Where is `proguard-android-optimize.txt` located? Do I need to create this file & put my configuration there?



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 3, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2018:00:06/12/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<android><proguard><android-proguard>', 'Title': "proguard doesn't remove logs", 'ViewCount': 1387, 'id': 50813589, 'user_AboutMe': '', 'user_AccountId': 383886.0, 'user_DisplayName': 'Leem', 'user_Reputation': 16242.0, 'user_Views': 864.0, 'user_id': 740018.0}}