Error:Execution failed for task ':app:preDebugAndroidTestBuild' , when tried to run java program in android studio

Kms :

Getting the below error at the time of running java program in android studio.

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.

Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

Any solution please. ?

mahmoud zaher :

thanks to @Ganesh Bhat and Chad Bingham

For those who still facing the problem, above answer did not help me in android studio 2.2 Preview.

This fixed my issue.

add this to your gradle file.

configurations.all {
  resolutionStrategy {
    force 'com.android.support:support-annotations:23.1.1'
 }
}

Reference: https://github.com/JakeWharton/u2020/blob/05a57bf43b9b61f16d32cbe8717af77cd608b0fb/build.gradle#L136-L140

Android support library error after updating to 23.3.0

Resolved versions for app (22.0.0) and test app (21.0.3) differ


update - if the previous answer doesn't work :

you should update the compileSdkVersion and appcompat to the latest update till now compileSdkVersion is 27 , also appcompat is 27.1.1 and 28.0.0-alpha1 is a pre-release version

thus

change

compileSdkVersion 27

the attached photo will help you

and

implementation 'com.android.support:appcompat-v7:26.1.0'

to latest update

implementation 'com.android.support:appcompat-v7:27.1.1'

you can check the latest updates from this link :

https://developer.android.com/topic/libraries/support-library/revisions

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=430684&siteId=1