I store my keystore at my assets directory. How can exclude it in the build to create the .apk?
I tried in that way but still there:
android {
...
packagingOptions {
...
exclude 'META-INF/LICENSE.txt'
...
exclude 'assets/keystore'
}
}
It exclude the LICENSE.txt
but not the keystore
Try with next:
...
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
android.applicationVariants.all { variant ->
//if (variant.name.contains('Release')) { // exclude source and sourcemap from release builds
def rmkeystore = task("delete${variant.name}.rmkeystore", type: Delete) {
delete "${buildDir}/intermediates/assets/${variant.dirName}/keystore"
}
variant.mergeAssets.finalizedBy rmkeystore
//}
}
Ref: https://stackoverflow.com/a/29168827/717267
This could help.
Or Simply:
exclude '**/assets/keystore'