[已解决]This project uses AndroidX dependencies, but the ......

小豆苗 1年前 ⋅ 3375 阅读

问题:

This project uses AndroidX dependencies, but the android.useAndroidX property is not enabled

解决办法:

第一步:查看下图中的gradle.properties文件是否存在

第二步:如果不存在直接复制如下内容,生成即可,如果存在修改成如下结果即可。

# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

主要是这两句:
android.useAndroidX=true
android.enableJetifier=true

最后:保存好后,点击右上角Sync Now,进行同步,结束即可。

 


全部评论: 0

    我有话说: