【问题标题】:AndroidX dependencies error on adding firebase to android将firebase添加到android时出现AndroidX依赖错误
【发布时间】:2021-10-28 10:30:23
【问题描述】:

我正在开发一个 android 项目,当我尝试将 firebase 依赖项添加到项目中时,出现构建错误。我已尝试迁移到 appCompat,但没有成功。

This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.The following AndroidX dependencies are detected: androidx.versionedparcelable:versionedparcelable:1.0.0, androidx.fragment:fragment:1.0.0, androidx.slidingpanelayout:slidingpanelayout:1.0.0, androidx.core:core:1.0.0, androidx.customview:customview:1.0.0, androidx.swiperefreshlayout:swiperefreshlayout:1.0.0, androidx.interpolator:interpolator:1.0.0, androidx.loader:loader:1.0.0, androidx.drawerlayout:drawerlayout:1.0.0, androidx.viewpager:viewpager:1.0.0, androidx.collection:collection:1.0.0, androidx.localbroadcastmanager:localbroadcastmanager:1.0.0, androidx.lifecycle:lifecycle-common:2.0.0, androidx.arch.core:core-common:2.0.0, androidx.annotation:annotation:1.1.0, androidx.legacy:legacy-support-core-ui:1.0.0, androidx.lifecycle:lifecycle-livedata:2.0.0, androidx.lifecycle:lifecycle-viewmodel:2.0.0, androidx.lifecycle:lifecycle-livedata-core:2.0.0, androidx.arch.core:core-runtime:2.0.0, androidx.legacy:legacy-support-core-utils:1.0.0, androidx.documentfile:documentfile:1.0.0, androidx.cursoradapter:cursoradapter:1.0.0, androidx.lifecycle:lifecycle-runtime:2.0.0, androidx.coordinatorlayout:coordinatorlayout:1.0.0, androidx.asynclayoutinflater:asynclayoutinflater:1.0.0, androidx.print:print:1.0.0

在没有firebase的情况下添加的依赖如下:

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'

请帮助解决上述问题。

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: android firebase android-gradle-plugin android-appcompat androidx


【解决方案1】:
android.useAndroidX=true

Android 插件使用适当的 AndroidX 库而不是支持库。

android.enableJetifier=true

Android 插件通过重写二进制文件自动迁移现有第三方库以使用 AndroidX

在您的 gradle.properties 文件中添加这两行。

然后清理项目并重建项目。

也许你的问题会得到解决。 如果不告诉我。

您当前使用的基于 Android 的库应该迁移到 Androidx。

我建议您在 Androidx 中迁移您的项目。 您可以轻松获得更多帖子如何将 android 迁移到 androidx 我的项目。

【讨论】:

    猜你喜欢
    • 2019-10-11
    • 1970-01-01
    • 2020-12-08
    • 2018-10-26
    • 1970-01-01
    • 2018-04-25
    • 2019-11-09
    • 2016-11-27
    • 1970-01-01
    相关资源
    最近更新 更多