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.
Add your AAR or JAR as a dependency To use your Android library's code in another app module, proceed as follows: Navigate to File > Project Structure > Dependencies. In the Declared Dependencies tab, click and select Jar Dependency in the dropdown. In the Add Jar/Aar Dependency dialog, first enter the path to your .
You can manually create the file in the \StudioProjects\your_project\app folder and you can add the custom rules.
The proguard-rules.pro file is where you can add custom ProGuard rules. By default, this file is located at the root of the module (next to the build.
In your Gradle file's default configuration closure, specify your Proguard file with consumerProguardFiles
instead of proguardFiles
. For example:
defaultConfig { consumerProguardFiles 'proguard.txt' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With