When I connect my own library to project, it doesn't optimize. So:
- In my lib, i turn on
minifyEnabled
:
apply plugin: 'com.android.library'
...
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
...
In project I implement my lib
implementation project(':somelib')
In my project, i turn on
minifyEnabled
:
...
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
...
- After build project, my lib is not optimized. I check it using APK Analyzer first then I use R8 and after it. Also, I connect lib in over project, where it is not used at all. But after optimization count method increased because I implement unused lib.
Proguard contains a standard autogenerated proguard-android.txt file with rules for Parseble and for butterknife6. Proguard-rules.pro is empty.
// default proguard-android.txt file
...
-keep public class * implements butterknife.Unbinder { public <init>(**, android.view.View); }
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }
-keep class **$$ViewInjector { *; }
-keepclassmembers class * implements android.os.Parcelable {
public static final ** CREATOR;
}
-keep class * implements android.os.Parcelable {
*;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}