Android libraries, per the AAR file spec, includes a 'proguard.txt' file. My understanding is that this file declares how the library correctly can be obfuscated and minified. In my case I need to preserve some API-classes.
How can I declare the library's proguard.txt file in the library's build.gradle? And will this file be automatically read when creating an application (APK) that uses my library?
I didn't find this information in Android's Gradle Plugin User Guide.
In your Gradle file's default configuration closure, specify your Proguard file with
consumerProguardFiles
instead ofproguardFiles
. For example:If you create library you can disable proguard and provide a
consumerProguardFiles
in youbuild.gradle
which will be used by consumer project which resolve itBut if you should enable proguard, for example, because you want distribute your library as archive - you are able to use the next possibility: