I had an issue when trying to set up a testing module, based on the model provided in module-flavor1-androidTest-only. I eventually realized that it was due to the fact that I had ABI splits set up in my application, leading the connectedAndroidTest task to fail.
I was able to reproduce the issue in this project by adding the following snippet inside the android block of the app module's build.gradle file:
splits.abi {
enable true
reset()
include 'armeabi', 'armeabi-v7a'
}
By running ./gradlew module-flavor1-androidTest-only:connectedDebugAndroidTest, I get the same exception as in my application.
> Expected configuration ':module-flavor1-androidTest-only:testTarget-metadata' to contain exactly one file, however, it contains no files.
By debugging Gradle, I found that the error occurs because TestApplicationData#getTestedApks handles modules with splits differently, since testedApkFiles.size() > 1 && splitSelectExe != null evaluates to true. The code then fails at TestApplicationData#loadMetadata.
I ended up disabling splits in my app, only when I'm running the instrumentation tests in this module. Any idea for a better workaround in the Gradle setup? Or is this just a bug in the Android Gradle Plugin which should be reported to their development team?
I had an issue when trying to set up a testing module, based on the model provided in
module-flavor1-androidTest-only
. I eventually realized that it was due to the fact that I had ABI splits set up in my application, leading theconnectedAndroidTest
task to fail.I was able to reproduce the issue in this project by adding the following snippet inside the
android
block of the app module'sbuild.gradle
file:By running
./gradlew module-flavor1-androidTest-only:connectedDebugAndroidTest
, I get the same exception as in my application.By debugging Gradle, I found that the error occurs because
TestApplicationData#getTestedApks
handles modules with splits differently, sincetestedApkFiles.size() > 1 && splitSelectExe != null
evaluates totrue
. The code then fails atTestApplicationData#loadMetadata
.I ended up disabling splits in my app, only when I'm running the instrumentation tests in this module. Any idea for a better workaround in the Gradle setup? Or is this just a bug in the Android Gradle Plugin which should be reported to their development team?