I updated the AndroidStudio to version 3.1
Clean Project...
and build failed
The SourceSet \'instrumentTest\' is not recognized by the Androi
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')
}
}
Just Replace instrumentTest by androidTest
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// instrumentTest.setRoot('tests')
androidTest.setRoot('tests')
}
Try change distributionUrl in you gradle/wrapper/gradle-wrapper.properties to last vesion:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
clean project and "Invalidate Cache/Restart" in File menu after this
Try with the Android Studio 3.1.2 update, which has a fix for this bug: https://developer.android.com/studio/releases/index.html#3-1-0
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.
1.you will face this type of issue while upgrading the gradle files 2.if ur project implements any payment gateways in their gradle file you find this "instrumentTest.setRoot('tests')".
Solution simple just replace this "instrumentTest.setRoot('tests')" with androidTest as show below images...
It will work @Ambilpura