Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Gradle sync complains about AndroidX dependencies or old support libraries

ErrorThis project uses AndroidX dependencies

Short answer

The project mixes AndroidX with the old Support Library. Make sure gradle.properties enables android.useAndroidX on AGP 8 and older, replace every com.android.support artifact with its androidx or Material equivalent, and turn on android.enableJetifier only when a third-party library you cannot update still uses the old packages.

  • Applies to Android Studio (current stable), Android Gradle Plugin 8.x and 9.x, Gradle 8.x and 9.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open gradle.properties in the project root and look for the two AndroidX flags, then list any leftover support-library lines in your build files.

    cat gradle.properties
    grep -rn "com.android.support" --include=*.gradle --include=*.kts .
  2. 2Match what you see, then jump to its fix

    1. 1The sync message names AndroidX dependencies while gradle.properties has no android.useAndroidX line, or has it set to false.android.useAndroidX is missing or falseFix
    2. 2Lines such as com.android.support:appcompat-v7 or com.android.support:design remain in the dependencies block, and imports still start with android.support.Old com.android.support libraries are still declaredFix
    3. 3Your own code is clean, but a dependency still references android.support classes.A third-party library still ships the old support packagesFix

What does the error look like?

  • This project uses AndroidX dependencies
  • android.useAndroidX
  • Android design support library not working after targeting API 28

Cause 1 of 3

android.useAndroidX is missing or false

1Check

The AndroidX overview says the flag is true by default only from Android Gradle Plugin 9.0.0; earlier versions default to false. Check which plugin version the project uses.

grep -n "useAndroidX" gradle.properties
grep -rn "com.android.application" --include=*.gradle --include=*.kts --include=*.toml .

2Fix

Add the flag to gradle.properties. The page also notes that the ability to set it to false is planned for removal in AGP 10, so do not set false.

# gradle.properties
android.useAndroidX=true

3Verify

Sync the project again (File, Sync Project with Gradle Files) or run a build.

./gradlew assembleDebug

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 3

Old com.android.support libraries are still declared

1Check

Support Library 28.0.0 was the last release, so nothing newer is published under that name. Search for every old coordinate.

grep -rn "com.android.support" --include=*.gradle --include=*.kts .

2Fix

Replace each artifact with its mapped AndroidX one. The mapping table lists appcompat-v7 as androidx.appcompat:appcompat and the design library as com.google.android.material:material. Then change the imports in your code to match.

dependencies {
    // before: implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'androidx.appcompat:appcompat:<version>'
    // before: implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.android.material:material:<version>'
}

3Verify

No old coordinate is left and the build passes.

grep -rn "com.android.support" --include=*.gradle --include=*.kts . || echo "none left"
./gradlew assembleDebug

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 3

A third-party library still ships the old support packages

1Check

Print the dependency tree and see which library pulls in the support artifacts.

./gradlew :app:dependencies --configuration debugRuntimeClasspath

2Fix

Update the library first; most of the ecosystem is already AndroidX. If you cannot, turn on Jetifier, which rewrites third-party binaries to AndroidX. The docs say it is false by default, planned for removal in AGP 10, and that it can slow builds, so remove it once the library is updated.

# gradle.properties
android.useAndroidX=true
android.enableJetifier=true

3Verify

Build again and then try removing the Jetifier line once the library is updated.

./gradlew clean assembleDebug

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Keep dependencies on AndroidX and Material artifacts only; the Support Library has no releases after 28.0.0.
  • Treat android.enableJetifier=true as a temporary bridge and re-test without it when you update libraries.
  • Use a version catalog so one artifact name is declared once.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Android Studio cannot pair the phone over Wi-Fi

The Pair devices over Wi-Fi dialog lists no device

Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.

4 causes, each with a fix

Mobile apps

adb tcpip 5555 fails because no device is found

adb: more than one device/emulator

adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.