Skip to content

Splits option breaks test module #24

Open
@MartinDevi

Description

@MartinDevi

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions