【发布时间】:2020-05-17 10:52:00
【问题描述】:
我正在尝试从使用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 中添加一些东西吗?为什么找不到类?
【问题讨论】:
-
如果它只发生在发布版本中,那么它是一个 pro-guard 问题。检查此快速修复:stackoverflow.com/a/61365688/3484700