The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin
instrumentTest has been deprecated and does not work with modern Gradle versions - which you probably updated in your project when upgrading Android Studio.
Replace instrumentTest with androidTest and it'll work.
Replace instrumentTest by androidTest as example below
android {
buildToolsVersion "27.0.3"
compileSdkVersion 24
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
androidTest.setRoot('tests')
}
}