AndroidX 依赖项和 XML 导致崩溃

标签 android xml layout dependencies androidx

最近更新到Android 3.3,现在很多依赖都改成了AndroidX .这导致应用程序崩溃,以及需要在 XML 中进行依赖项更改也是。我遇到了与 CoordinatorLayout 类似的问题.我搜索了stackoverflow,关于这个主题没有很多问题,因为AndroidX比较新。所以我觉得有必要在这方面提出一个问题。
我在哪里可以获得 FloatingActionButton 的 xml对于所有 XML有没有一个网站可以让我们获取 androidX 依赖项的 XML。
XML

 <android.support.design.widget.FloatingActionButton
崩溃 Logcat

android.view.InflateException: Binary XML file line #15: Binary XML file line #15: Error inflating class android.support.design.widget.FloatingActionButton Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class android.support.design.widget.FloatingActionButton Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.FloatingActionButton" on path: DexPathList[[zip file "/data/app/com.kc.unsplashdemo-kTZQS-p2845Xly7PcTuAmg==/base.apk", zip file "/data/app/com.kc.unsplashdemo-kTZQS-p2845Xly7PcTuAmg==/split_lib_dependencies_apk.apk", zip file


依赖
dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation project(':androidunsplash')
        implementation 'com.squareup.picasso:picasso:2.71828'
        implementation("com.squareup.okhttp3:okhttp:3.12.0")
        implementation 'androidx.recyclerview:recyclerview:1.0.0'
        implementation 'com.google.code.gson:gson:2.8.5'
    
        implementation 'com.google.android.material:material:1.0.0'
        implementation 'androidx.appcompat:appcompat:1.0.2'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.1'
    }

最佳答案

您可以找到旧 android 的映射 依赖 反对新的 谁使用 安卓x here

在那里你会找到你正在寻找的依赖项:

com.google.android.material.floatingactionbutton.FloatingActionButton

在布局上替换某些东西时,我建议使用 ctrl + r在整个项目中更新它并节省您的时间,因为在迁移到 androidx 时确实需要做很多手动工作。

关于AndroidX 依赖项和 XML 导致崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54731643/

相关文章:

java - 在 Firebase Android 中将带有子项的值转换为 Java 对象

android - ScrollView 中的 ListView 在 Android 上不滚动

java - 在 Java 中解析格式错误的日期时间字符串

c# - 使用 Linq 一般展平 XDocument?

javascript - 使用 Javascript 从服务器获取文件

CSS布局最佳实践

java - 具有动态 fragment 的 Android 项目在模拟器上崩溃?

xml - Spark Dataset write()方法返回错误

java - Android:将textView放在ListView下面

android - FloatingActionButton : NoSuchMethodException 布局膨胀错误