Ошибка Unknown fragments и вылет

Рейтинг: 0Ответов: 0Опубликовано: 04.08.2023

Не пойму что этот андроид хочет, 100 раз делал, сейчас ошибка:

Unknown fragments 
A <androidx.fragment.app.FragmentContainerView> tag allows a layout file to dynamically include different layouts at runtime. At layout editing time the specific layout to be used is not known. You can choose which layout you would like previewed while editing the layout.

Вот

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
        <fragment
            android:id="@+id/nav_host_fragment_main"
            android:name="androidx.navigation.fragment.NavHostFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:navGraph="@navigation/main_navigation"
           />
    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

Если запустить вылетает с Exception

FATAL EXCEPTION: main
                                                                                                    Process: app.slot.slotmachine, PID: 6817
                                                                                                    java.lang.RuntimeException: Unable to start activity ComponentInfo{app.slot.slotmachine/app.slot.slotmachine.MainActivity}: android.view.InflateException: Binary XML file line #16 in app.slot.slotmachine:layout/activity_main: Binary XML file line #16 in app.slot.slotmachine:layout/activity_main: Error inflating class fragment
                                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
                                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
                                                                                                        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)

Ответы

Ответов пока нет.