Skip to content

Instantly share code, notes, and snippets.

@cbeyls
Created October 28, 2021 09:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbeyls/6ca21e9a8ed0e0ba65cee3c4d4734091 to your computer and use it in GitHub Desktop.
Save cbeyls/6ca21e9a8ed0e0ba65cee3c4d4734091 to your computer and use it in GitHub Desktop.
Ignore Proguard rules of jetified library dependencies
// 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