How to use code in androidTest directory of another module

I’ve been looking for a solution to this for a while and finally found something that works for me.

This will allow you to put common testing classes in another module.

android {
    ...

    sourceSets {
        androidTest.java.srcDirs += ["${project('match the module name that is currently in the dependencies').projectDir}/src/androidTest/java"]
    }
}

So for the example above it would probably look something like

androidTest.java.srcDirs += ["${project(':appbase').projectDir}/src/androidTest/java"]

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)