Android 安卓工作室新抽屉活动不';不显示任何组件,但布局名称显示在设计器上

Android 安卓工作室新抽屉活动不';不显示任何组件,但布局名称显示在设计器上,android,android-studio,rendering,navigation-drawer,Android,Android Studio,Rendering,Navigation Drawer,我是安卓工作室的新手,我很认真地面对大多数由于错误而导致的问题。我试图创建一个空抽屉活动,但并没有显示任何组件,但布局的名称显示在Designer上 我遇到了渲染错误,并且即使我没有更改单个单词,也无法启动类错误 我尝试了一些关于堆栈溢出的解决方案,但没有一个有效 错误 The following classes could not be instantiated: - android.support.design.widget.CoordinatorLayout (Open Class, Sh

我是安卓工作室的新手,我很认真地面对大多数由于错误而导致的问题。我试图创建一个空抽屉活动,但并没有显示任何组件,但布局的名称显示在Designer上

我遇到了渲染错误,并且即使我没有更改单个单词,也无法启动类错误

我尝试了一些关于堆栈溢出的解决方案,但没有一个有效

错误

The following classes could not be instantiated:
- android.support.design.widget.CoordinatorLayout (Open Class, Show 
Exception, Clear Cache)
- android.support.design.widget.AppBarLayout (Open Class, Show Exception, 
Clear Cache)
- android.support.design.widget.FloatingActionButton (Open Class, Show 
Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample 
data when shown in the IDE.  If this is an unexpected error you can also try 
to build the project, then manually refresh the layout.  Exception Details 
java.lang.ClassNotFoundException: 
android.view.View$OnUnhandledKeyEventListener Copy stack to clipboard

这是设计师的照片,在谷歌搜索了大约三到四天后,终于找到了一个解决办法

我将SDK版本从28改为26,在build.gradle文件中将28改为26,它成功了。最后

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.example.itnoa.asdf"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
  implementation fileTree(include: ['*.jar'], dir: 'libs')
  implementation 'com.android.support:appcompat-v7:26.0.0'
  implementation 'com.android.support.constraint:constraint-layout:1.1.2'
  implementation 'com.android.support:support-v4:26.0.0-alpha3'
  implementation 'com.android.support:support-v4'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

我希望这对其他人有所帮助:-)

你有没有检查是否添加了依赖项?@Sabarinathan yes man所有内容都添加好了,我真的很沮丧。首先,它发生在基本的空活动中,没有一个组件显示在designer中,我和我不得不浪费一天时间,最终发现改变主题可以解决它,现在这个问题。