Fix 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.
This error appeared when i was trying to build a new app project in the android studio in a fresh start, i mean the app is a new project, no codes were written, no libraries were added, still this error appeared and it was easy to fix by removing some test libraries in the build.gradle (module.app). i am not sure if this will cause any new error when building and deploying the project in future, but for now, after removing the 2 libraries, the gradle build was successful.
The libraries i removed were these:
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

The successful build after removing these 2 libraries
