Is there a way to specify an additional AndroidManifest.xml file for a gradle test aplication? I need it to specify additional permissions and activities for my unit tests.
UPD:
I've tried to add instrumnetTest section in the build.gradle file, but it didn't help and I still get Unable to resolve activity for: Intent error
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest {
manifest.srcFile 'src/instrumentTest/AndroidManifest.xml'
java.srcDir 'src/instrumentTest/Java'
}
}
You can specify an special AndroidManifest.xml for Android Tests (formerly called Instrument Tests) if you are able to use the 0.13.0 (or later) release of the Android Gradle Plugin.
Simply put the file at src/androidTest/AndroidManifest.xml - the manifest merger will take care of the file when you run the gradle test task.
There's an example in the official documentation "gradle-samples-0.13.zip\gradle-samples-0.13\androidManifestInTest" - as one can see there's no special configuration needed to have the test manifest included.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With