Why Android Studio is forcing to use Androidx from Android support library?

According from Dan Lew

The support library artifacts are being deprecated and all future development is going into AndroidX, so there's no avoiding this migration. Hopefully, though, these tips will give you a clearer transition path.


You can lock down your googleservices and firebase versions to avoid androidX.

In android/build.gradle add:

buildscript {
  ...
  ext {
    // Lock down googlePlayServicesVersion
    googlePlayServicesVersion = "16.1.0"
    firebaseVersion = "17.6.0"
  }
}

OR in gradle.properties add:

googlePlayServicesVersion=16.1.0
firebaseVersion=17.6.0

Probably post your app level gradle file here. Ideally if you are using some other dependency which is the updated/latest one then you would get this error.

If any of the dependency is the latest/updated one please downgrade it to the lesser version from checking the change logs from it's github. For me the culprit was stripe version which was internally using the androidx and was getting this error. i downgraded it and boom! It's gone :)

And also disable the androidx from gradle.properties file using

android.useAndroidX=false
android.enableJetifier=false

Which forces the androidx to be disabled.