Android studio Disable AndroidX Mode

  • 2021-12-04 11:13:30
  • OfStack

gradle. properties file

android. useAndroidX=false # Disable AndroidX
android. enableJetifier=false # Prohibit androidX from third party jar package

Additional knowledge: Resolving Android Studio androidx packet collisions

If the package conflicts, it will package the following errors:

Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution

1. Open Terminal

Enter:

./gradlew -q app:dependencies

View dependency conflict files

2. Add under buildscript tab in build. gradle


subprojects {
  project.configurations.all {
   resolutionStrategy.eachDependency { details ->
    if (details.requested.group == 'com.android.support'
      && !details.requested.name.contains('multidex') ) {
     details.useVersion "27.1.1"
    }

    if (details.requested.group == 'androidx.core'
      && !details.requested.name.contains('androidx') ) {
     
    }
   }
  }
 }

A package conflict is in group androidx. core and specifies the version to be used by Androidx


Related articles: