【发布时间】:2020-09-18 18:19:42
【问题描述】:
我想使用 firebase 远程配置库(com.google.firebase:firebase-config:19.1.4)。当我将其依赖项添加到 app gradle 中时,出现以下错误。
ERROR: 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
Affected Modules: app
我的app gradle如下:
android {
compileSdkVersion 27
defaultConfig {
applicationId "in.co.gramafone.client"
minSdkVersion 16
targetSdkVersion 27
versionCode 19
versionName "1.1.1"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
...
}
我广泛使用 android 支持库(com.android.support:appcompat-v7:27.1.1)。所以,如果我通过下面的行来解决这个问题来启用 androidX,还有很多其他库冲突正在报告(如果这些错误是必要的,我可以发布)
android.useAndroidX=true
android.enableJetifier=true
如果需要任何其他信息来了解实际问题,请告诉我。
注意:我是安卓世界的新手
【问题讨论】:
-
我想你把
build.gradle和gradle.properties弄错了。gradle.properties是您项目中的另一个文件。 -
我被这条消息弄糊涂了,因为我在我的项目中找不到一个完全名为“gradle.properites”的文件。但是,我从另一个项目中复制了该文件,而它恰好已经有了这些值。
标签: android-studio gradle android-support-library androidx firebase-remote-config