Getting the below error at the time of running java program in android studio.
Error:Execution failed for task \':app:preDebugAndroidTestBuild\'.
<
Well, I too faced the same problem here is how I fixed it
There you will find what are all the config's you have set up. In my case here
android{
**compileSdkVersion 26**
defaultConfig {
applicationId "com.xxxxxxxxxxx.yyyyyyyy.zzz"
minSdkVersion 19
**targetSdkVersion 26**
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:26.1.0'**
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
So here just change the compileSdkVersion & targetSdkVersion from 26 to 27 and
from dependencies change support appcomat
from implementation 'com.android.support:appcompat-v7:26.1.0'
to implementation 'com.android.support:appcompat-v7:27.1.1'
android {
**compileSdkVersion 27**
defaultConfig {
applicationId "com.xxxxxxxxxxx.yyyyyyyy.zzz"
minSdkVersion 19
**targetSdkVersion 27**
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:27.1.1'**
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Got Fixed !!!