繁体   English   中英

找不到以下类错误(最新版本)

[英]The Following Classes Could not Be Found Error (latest version)

我收到错误

The following classes could not be found:
- android.support.design.widget.CoordinatorLayout (Fix Build Path, Edit XML, Create Class)
- android.support.design.widget.NavigationView (Fix Build Path, Edit XML, Create Class)
- android.support.v4.widget.DrawerLayout (Fix Build Path, Edit XML, Create Class)
Tip: Try to build the project.

这是我的模块应用程序:

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

我尝试重建、清理和更改实现,但似乎没有任何效果

有谁知道我该如何解决这个问题? 它始于我更新 android 工作室并创建了一个新项目。

您的依赖混合了支持库和 AndroidX,这是不对的。 使用Android Studio将其重构为 AndroidX。

Refactor > Migrate to AndroidX并按Do Refactor

你必须使用

androidx.coordinatorlayout.widget.CoordinatorLayout
com.google.android.material.navigation.NavigationView
androidx.drawerlayout.widget.DrawerLayout

代替

android.support.design.widget.CoordinatorLayout
android.support.design.widget.NavigationView
android.support.v4.widget.DrawerLayout

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM