Error:Execution failed for task \':app:preDebugAndroidTestBuild\'.
Conflict with dependency \'com.android.support:support-annotations\' in project \':app\
Based on the documentation:
Both your app APK and its test APK share the same classpath. So, you can get a build error if both APKs depend on different versions of the same library.
So the fix would be to change your
com.android.support:appcompat-v7:26.1.0
to
com.android.support:appcompat-v7:27.1.1