Created
October 28, 2021 09:52
-
-
Save cbeyls/6ca21e9a8ed0e0ba65cee3c4d4734091 to your computer and use it in GitHub Desktop.
Ignore Proguard rules of jetified library dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add the following to your Android app module build.gradle file, after the android section: | |
// Replace "proguard.txt" with the actual name of the proguard rules file in the library aar, if different | |
afterEvaluate { | |
// Update configuration of the minify tasks to exclude specific consumer Proguard rules files | |
tasks.findAll { task -> task.name.startsWith('minify') }.each { task -> | |
task.configure { | |
configurationFiles.from.collect().each { fileCollection -> | |
if (fileCollection instanceof FileCollection) { | |
configurationFiles.from.remove fileCollection | |
configurationFiles.from.add fileCollection.filter { file -> | |
// Ignore "My Library" SDK rules | |
!file.path.endsWith("/jetified-$myLibraryArtifactId-$myLibraryVersion/proguard.txt") | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment