当前位置: 首页 > 知识库问答 >
问题:

迁移到Android X应用程序崩溃后,Android.view.InflateException

白吕恭
2023-03-14

共有1个答案

云和硕
2023-03-14

经过一些调试,我发现当project在迁移前使用material-components-android时会出现问题,有些事情必须手动完成:

>

  • textInputLayout子视图应为com.google.android.material.textfield.textInputedittext而不是EditText或appcompatedittext:

    <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/input_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
    
                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/edit_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
    

    TextInputLayout应该使用从Widget.MaterialComponents.TextInputLayout.FilledBox继承的Android:Theme和app:errorTextExpersion

    xml:

    <style name="TextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
        ...
    </style>
    <style name="TextInputLayoutErrorAppearance" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
        ...
    </style>
    

    layout.xml

    <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/input_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:theme="@style/TextInputLayoutStyle"
                    app:errorEnabled="true"
                    app:errorTextAppearance="@style/TextInputLayoutErrorAppearance">
    
                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/edit_text"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"/>
    </com.google.android.material.textfield.TextInputLayout>
    

    如果您有用于密码输入的切换,则必须将app:passwordToggleEnabled和app:passwordToggletint替换为app:endiconmode=“password_toggle”

    <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/password_input_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:errorEnabled="true"
                    app:endIconMode="password_toggle">
    
    
                <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/password_edit_text"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="textPassword"/>
    

  •  类似资料:
    • 整个堆栈仅包括android核心代码: 它发生在替换主活动中的片段时:

    • 我正试图迁移到AndroidX,我们在我们的项目中使用这个库。然而,这目前在我们的项目中引起了一个问题: 无法解析对“module @ build type/compile class path”的依赖项:无法使用转换JetifyTransform转换文件“localytics-1.3.0.aar”以匹配属性{artifactType=processed-aar} 删除库会使此问题消失。在这个库被

    • Fabric SDK现在已被弃用,并将继续报告应用程序的崩溃,直到2020年11月15日。 我在哪里可以找到这些报告?我不能再登录到fabric dashboard了,它们也没有显示在firebase控制台中。

    • 我迁移到Android studio,在我尝试运行该应用程序之前,一切似乎都正常。它在发射器活动中卡住,然后崩溃,打印:

    • 问题内容: MongoDB刚刚强制将我的Heroku服务器上的更新从2.6更新为3.0 现在,我的应用在启动后不久因以下错误而崩溃: 我检查了他们的状态页,发现Mongo已将其服务器更新为3.0版,而且该更新现在应该稳定了,因此这是我需要做的事情。 在看了一些之后。我发现应该安装新的“驱动程序”以与3.0版兼容。 我发现此链接http://docs.mongodb.org/manual/relea

    • 我已经将我们的项目迁移到androidx,现在该应用程序在API21及以上版本上运行,但在API21及以上版本下无法运行。这款应用正在使用multidexing,之前也一直在使用,运行良好。现在我只是得到一个致命的信号11和没有更多有用的日志时,应用程序崩溃。该系统在空气污染指数21或以上时仍然运作良好。你有什么线索或暗示我如何更接近解决这个问题吗?