I need to do some auto testing jobs to an Android application without its source code. I found both robotium and espresso can do this job, I decided to use espresso because its
I had this same issue, one thing that was ruining my test build is the following line:
main { java.srcDirs = ['src/main/java', 'src/AndroidTests', 'src/AndroidTest/java'] }
Remove test code from srcDirs:
sourceSets { .... main { java.srcDirs = ['src/main/java'] } }