How to exclude file from resources using Gradle and Android Studio?
I have a generated string resource xml file in my project which is generated from a file with a .template extension. I'm trying to exclude this template from the build since it gives me duplicate resource error. The following does not work for me and I'm stuck: sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['res'] resources.exclude '**/build_id.template' res.srcDirs = ['res'] res.exclude '**/build_id.template' assets.srcDirs = ['assets'] } } The error: Error:Error: Duplicate resources: <project-dir>/res/values/build_id.template:string