Android Studio布局页面报错【Design editor is unavailable until a successful build】

每次更新AndroidStudio都会出现一堆问题,今天更新完后Android Studio后就发现布局页面不知道哪里去了(内心瞬间万马奔腾,@#@%@#@…)。。。
苏青岩

报错原因:
Design editor is unavailable until a successful build.
设计编辑器不可用,直到成功构建为止。(构建不成功?!)

Error:Execution failed for task ‘:app:preDebugAndroidTestBuild’.
Resolved versions for app (26.1.0) and test app (27.1.1) differ.
解决版本的应用程序(21.1.0)和测试应用程序(27.1.1)不同。

所以问题是 ——版本冲突,于是在external library中寻找
发现报错项目中有两个com.android.support:support-annotations
在这里插入图片描述
解决方案:
在app下的build.gradle文件中的dependences {}中添加如下代码:

dependencies {
  androidTestCompile('com.android.support:support-annotations:26.1.0') {
        force = true
    }
...
}

版权声明:本文为qq_35953420原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。