Search code examples
androidandroid-studioproguard

Proguard won't include a library


I have an android app which makes use of the following library:

implementation "com.mikepenz:aboutlibraries-core:7.1.0"
implementation "com.mikepenz:aboutlibraries:7.1.0"

Which generates a list and UI about the 3rd party libraries used in my project. When I have minifyEnabled false it runs and does display the list of the 3rd party libraries. But when I have minifyEnabled true, it does not display it.

So I realised the issue could be with proguard and I checked the file, it has no sign of the library in there, so I added this line of code in proguard

-keep class com.mikepenz.aboutlibraries.** { *; }

But it still won't show the list of the 3rd party libraries as it does when minifyEnabled is false.

Any help or advice will be highly appreciated.


Solution

  • As they mentioned in their doc, You should put these lines in your proguard-rules.pro:

    -keepclasseswithmembers class **.R$* {
        public static final int define_*;
    }
    -keep class .R
    -keep class **.R$* {
        <fields>;
    }