Your usage of source sets is wrong. It is not inside each build type closure. They are declared on their own:
android {
buildTypes {
debug {
...
}
release {
...
}
utest {
...
}
}
sourceSets {
debug {
...
}
release {
...
}
utest {
...
}
}
}
Note that the build types have their own source sets on top of the 'main' source sets. So you shouldn't set all the build type sourceset to use 'src'. You could do
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
utest {
manifest.srcFile 'utest/AndroidManifest.xml'
java.srcDirs = ['utest']
}
}
}
Note that in this case the manifest under utest/AndroidManifest.xml
will be merged in the main manifest.