android.view.InflateException:二进制 XML 文件行 #15:二进制 XML 文件行 #19:膨胀类片段时出错

问题描述 投票:0回答:3

我在启动应用程序时出错。我的代码没有错误,但我仍然收到此错误。帮我看看如何解决。

android.view.InflateException:二进制 XML 文件第 15 行:二进制 XML 文件第 19 行:膨胀类片段时出错

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:showIn="@layout/app_bar_main1">

    <fragment
        android:id="@+id/nav_host_fragment_content_main1"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:defaultNavHost="true"                        <---- THIS IS 15
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:navGraph="@navigation/mobile_navigation" />   <----THIS IS 19

</androidx.constraintlayout.widget.ConstraintLayout>
runtime-error fragment inflate-exception
3个回答
0
投票

我终于找到了真正的问题。我的视图模型有问题。发生这个错误是因为fragment中有逻辑错误


0
投票

LinkajaBEN 崩溃了 android.view.InflateException:二进制 XML 文件第 15 行:二进制 XML 文件第 15 行:膨胀类 module.corecustomer.basepresentation.widge.OfflineModeWidget 时出错 原因:android.view.InflateException:二进制 XML 文件第 15 行:膨胀时出错类 module.corecustomer.basepresentation.widge.OfflineModeWidget 引起原因:java.lang.reflect.Constructor.newInstance0(本机方法)处的java.lang.reflect.InitationTargetException


0
投票

我也面临同样的问题,你能详细说明一下解决方案吗?

© www.soinside.com 2019 - 2024. All rights reserved.