I\'m importing an android library in an application built with gradle, like that:
dependencies {
compile \'com.e
I had success with this approach (updated 2019-5-13 for TaskProvider
support; see edit history for older versions):
android {
⋮
applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.mergeAssetsProvider.configure {
doLast {
delete(fileTree(dir: outputDir, includes: ['**/js', '**/*.js.map']))
}
}
}
}
⋮
}
This should address the issues with @Xavier's answer:
mergeAssets
task so the deletion is reflected in the task's output and up-to-date checking should be unaffected.buildType
name, which is less problematic than matching the entire variant name (though it is still stringly typed).Note that this approach also works for res
files rather than assets
: just replace mergeAssets
with mergeResources
.
Other answers mentioning packagingOptions
and aaptOptions
are barking up the wrong tree, as these are scoped to all variants (they are defined in the android
scope, not buildType
or productFlavor
).