Java I';我在布局预览中遇到了缺少类的问题

Java I';我在布局预览中遇到了缺少类的问题,java,android,Java,Android,我遇到了缺课的问题。 找不到以下类:“让我恶心的消息 我在stackoverflow answers中尝试了大多数答案,但毫无帮助。 我使用导航栏项目创建文件,然后将我的文件应用于Firebase 我试图更改依赖项和样式文件。 这是我的依赖: implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0' implementation

我遇到了缺课的问题。 找不到以下类:“让我恶心的消息

我在stackoverflow answers中尝试了大多数答案,但毫无帮助。 我使用导航栏项目创建文件,然后将我的文件应用于Firebase

我试图更改依赖项和样式文件。 这是我的依赖:

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
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'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
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'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
这是我的风格代码

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay"     
parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
这是xml文件

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout                         
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">

<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />

</android.support.v4.widget.DrawerLayout>

这些是我的错误信息。它在预览错误中给出

找不到以下类: -android.support.constraint.ConstraintLayout(将约束布局库依赖项添加到项目中,修复构建路径,编辑XML,创建类) -android.support.design.widget.AppBarLayout(修复构建路径、编辑XML、创建类) -android.support.design.widget.CoordinatorLayout(修复构建路径、编辑XML、创建类) -android.support.design.widget.FloatingActionButton(修复构建路径、编辑XML、创建类) -android.support.design.widget.NavigationView(修复构建路径、编辑XML、创建类) -android.support.v4.widget.DrawerLayout(修复构建路径、编辑XML、创建类) -android.support.v7.widget.Toolbar(修复构建路径、编辑XML、创建类)

有什么我能解决的吗? 还是我必须重新设置一切

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
然后读

您的XML将-->


唉,我忘了写那个了。我已经更新了sdkmanagement@JaesukPark重构->迁移到AndroidX当我添加它说它是无效语句时。我必须在android x中迁移吗?哇。这真的奏效了。所以问题是androidX的迁移。实际上,我第一次使用API 28。这真的很有帮助!
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
 <androidx.constraintlayout.widget.ConstraintLayout
 <com.google.android.material.navigation.NavigationView
 <androidx.cardview.widget.CardView
 <androidx.appcompat.widget.Toolbar
 <com.google.android.material.appbar.AppBarLayout
 <androidx.coordinatorlayout.widget.CoordinatorLayout
 implementation 'com.android.support.constraint:constraint-layout:1.1.2'