Is there a way to share code between those two without creating another module/external library ?
It's been 5 years so hopefully you figured it out, but in case someone stumbles on this.
// This allows us to share classes between androidTest & test directories.
android.sourceSets {
test {
java.srcDirs += "$projectDir/src/testShared"
}
androidTest {
java.srcDirs += "$projectDir/src/testShared"
}
}