Android Studio androidTest sourceSets gradle not recognized

By | September 13, 2015

Android Studio (app) build.gradle sourceSets androidTest java.srcDir property may not be recognized when using the array format of this source directory property setting.

BAD

sourceSets {
    androidTest {
        java.srcDirs = ['androidTest/java']
    }
}

GOOD

sourceSets {
    androidTest {
        java.srcDir file('androidTest/java')
    }
}

For setting up Robotium UI / Integration testing, it’s important that your androidTest source directory is recognized.


Related Articles: