Reputation: 326
I've recently updated an existing Android project to use Android Studio, and haven't been able to get it to build:
Execution failed for task ':mergeDebugResources'.
> Index: 0
After some experimenting I've found that it's choking on our source control's hidden directories, .arch-ids, which exist in every folder.
I've tried manipulating build.gradle with the exclude keyword, to no avail:
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java {
srcDirs = ['src']
exclude '**/.arch-ids/*'
}
resources {
srcDirs 'src'
exclude '**/.arch-ids/*'
}
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res {
srcDirs = ['res']
}
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
The 'res' part seems to be the culprit at the moment, but it doesn't support the 'exclude' keyword.
Upvotes: 2
Views: 1759
Reputation: 309
You may try something like:
android {
...
sourceSets {
main {
...
res.srcDirs = ['build/filtered_resources']
...
}
...
}
and then task dependency to use filtered resources copy:
task __filteredResources(type:Copy) {
from('res/') {
exclude '**/.arch-ids/*'
}
into 'build/filtered_resources'
includeEmptyDirs = true
}
tasks.whenTaskAdded { task ->
if (task.name == 'generateBuildConfig') {
task.dependsOn __filteredResources
}
}
Upvotes: 4