在新建佈局文件的時候,頁面顯示:html
design editor is unavailable until a successful build(設計編輯器不可用,直到成功建立。)android
細看下面還有一行錯誤:app
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.(':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.佈局
( ':app'.項目中的 'com.android.support:support-annotations' 有衝突,應用是26.1.0,測試應用是27.1.1。)測試
解決方法:gradle
在build.gradle的文件中加入兩行代碼:ui
implementation'com.android.support:appcompat-v7:27.1.1'spa
androidTestImplementation'com.android.support:support-annotations:27.1.1'設計
同時更正build.gradle中的compileSdkVersion和targetSdkVersion版本爲27:
android {
compileSdkVersion27
defaultConfig {
applicationId"com.example.culif.activitytest"
minSdkVersion27
targetSdkVersion27
versionCode1
versionName"1.0"
testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
}