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

Use implementation 'com.android.support:appcompat-v7:27.1.1' instead of implementation 'com.android.support:appcompat-v7:26.1.0' and change compileSdkVersion 26 to 27


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


I answered before some minutes same question Reference. If you are not going to implement testing code, then remove junit from your app.

There are lot of other questions related to this.

Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (23.1.1) differ

Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (23.0.1) differ

Tags:

Java

Android