Search code examples
androidkotlinandroid-studiogradleandroidx

gradle-wrapper.properties not being picked up by Gradle


I'm trying to get an Android project to build with the latest version of Android Studio. The project was put together by someone else.

When I try to build the project I get an error saying "Configuration :app:debugRuntimeClasspath contains AndroidX dependencies, but the android.useAndroidX property is not enabled, which make cause runtime issues. Set android.useAndroidX=true in the gradle.properties file and retry."

In the gradle-wrapper.properties file I can see the property has been set. There is no gradle.properties in the project "Gradle Scripts" section. Only two build.gradle files, proguard-rules.pro, gradle-wrapper.properties, local.properties and settings.gradle.

How can I go about debugging this project? I'm struggling to find any related issues. I have tried adding a gradle.properties file but get the same error. Thanks in advance.


Solution

  • Within gradle-wrapper.properties this is pretty useless, as that is a properties file for the Gradle wrapper, not the actual build. I would really wonder if any plugin would search the value there, Gradle for sure is not.

    gradle.properties is exactly the file where you should set that property. The file should be in the project directory, maybe you created it in the wrong place when it did not work, or you did not put the correct content into it.