迁移到AndroidX后,AppBarLayout膨胀错误

编程入门 行业动态 更新时间:2024-10-20 13:48:03
本文介绍了迁移到AndroidX后,AppBarLayout膨胀错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

迁移到AndroidX时,我遇到了这个问题:

When migrating to AndroidX I faced this problem:

Java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mandarine.android/com.mandarine.android.features.root.RootActivity}: android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class android.support.design.widget.AppBarLayout

推荐答案

除非实现旧的支持库并启用Jetifier,否则必须重命名XML中的所有支持类.

Unless you implement the old support libraries and enable Jetifier, you have to rename all your support classes in XML.

android.support.design.widget.AppBarLayout现在是com.google.android.material.appbar.AppBarLayout.

为此,您可能需要在build.gradle中使用implementation 'com.google.android.material:material:1.0.0-beta01'.

You may need to use implementation 'com.google.android.material:material:1.0.0-beta01' in your build.gradle for this.

使用支持库查找XML中的任何其他视图,然后重命名标签以匹配其AndroidX版本.您只需在Google中搜索"ClassName AndroidX",即可找到该类的文档.

Look for any other Views in XML using the support library and rename the tags to match their AndroidX versions. You can simply search "ClassName AndroidX" in Google and you'll find the documentation for that class.

更多推荐

迁移到AndroidX后,AppBarLayout膨胀错误

本文发布于:2023-11-15 23:37:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598975.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   AndroidX   AppBarLayout

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!