android - 使用 androidx.fragment.app.FragmentContainerView 时出现 ClassNotFoundException
问题描述
我正在尝试从使用 a 过渡FrameLayout
到 usingFragmentContainerView
以及我看过的教程,这应该很容易。但是,当我在进行更改后运行我的应用程序时,我得到了
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 中添加一些东西吗?为什么找不到类?
解决方案
这是androidx.fragment
1.2.0 或更高版本:
implementation "androidx.fragment:fragment:1.2.0"
推荐阅读
- scikit-learn - MultiLabelBinarizer:inverse_transform 在单个样本上失败?
- ios - 如何使用条件 IF 打开新视图
- nginx - HTTP 426 与 nginx 代理通行证
- javascript - Javascript 在没有页面更新的情况下获得价值
- c - 将动态分配的指针传递给 pthread 的正确方法是什么
- python-3.x - 如何在python 3中用回车分隔字符串
- c# - 在面板中的表之间添加空格
- c++ - 将 std::conditional 与不可转换的类型一起使用(原始与指针)
- c++ - 使用带有无法识别的长选项的“getopt_long”时出现分段错误
- javascript - 如何使用 jest 和 travis-ci 构建过程修复“在集成测试中拒绝访问”