关于CoordinatorLayout在XML文件中报错的问题

最近的项目是使用的andoidx,开始报错时,我以为是没有导入desgin包,结果导入之后,还是报错,错误如下:

Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout
    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.CoordinatorLayout" on path: DexPathList[[zip file "/data/app/xxx-km5ffPBLI77BSPJ26J3tpQ==/base.apk"],nativeLibraryDirectories=[/data/app/xxx-km5ffPBLI77BSPJ26J3tpQ==/lib/x86, /data/app/xxx-km5ffPBLI77BSPJ26J3tpQ==/base.apk!/lib/x86, /system/lib, /system/vendor/lib]]

 

后来一拍脑袋想起来,我的项目是androidx啊,所以直接ctrl+H,搜索CoordinatorLayout,找到全路径

androidx.coordinatorlayout.widget.CoordinatorLayout

修改就可以了。

接着,就是AppBarLayout了,也改了,路径是:com.google.android.material.appbar.AppBarLayout

你可能感兴趣的:(android)