最近更新到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/