我正在尝试从使用FrameLayout
转换为使用FragmentContainerView
,而从我看到的教程来看,这应该很容易。但是,在更改后运行我的应用程序时,我遇到了以下问题:
Error inflating class androidx.fragment.app.FragmentContainerView
Caused by: java.lang.ClassNotFoundException: androidx.fragment.app.FragmentContainerView
我的布局文件非常简单:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="@layout/app_bar_main">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
我需要在build.gradle中添加什么内容吗?为什么找不到这个类?