I have the same issue mentioned in this post AndroidTest Manifest permission not detected
and this post AndroidManifest in androidTest directory being ignored
--> If I put the test manifest in androidTest
, debugAndroidTest
, androidTestDebug
, it never gets picked up and merged.
the answers about putting the AndroidManifest.xml in the debug
folder are correct; that does seem to work. (put the test manifest in src/debug
What I want to know is why can't you put it in the androidTest
directory? All the documentation I've read while trying to figure this out makes it sound like you should be able to, and that if you can't then I'm thinking that sounds like some bug in the manifest merger.
For what it's worth, I'm using Android Studio
That is correct and totally agree with you on the confusing documentation. The AndroidManifest.xml
under androidTest*
source sets would be packaged for the instrumentation APK that does your tests on your actual app APK. If you open the generated APKs for debug
and androidTest
under build/outputs/apk/
after compiling your app module with the command gradlew assembleDebugAndroidTest
(assuming that you haven't changed the testBuildType
in you build.gradle
, more info here), you'll find that any AndroidManifest.xml
configuration added under androidTest
will be in the androidTest
APK and not in your debug
app APK.
And also as you said, in case you need test specific configurations like extra permissions, you'll have to place them in the AndroidManifest.xml
under the debug
source set instead of main
, hence they'll only be available for testing your app but not in your release build. Of course you can always double check by opening the generated APKs after compiling to make sure that the configuration is right for each build variant.
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