To use androidx, make these changes in the gradle files:

Build.gradle: (replace dependencies with this)

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

testImplementation 'junit:junit:4.13.2'

androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}


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

(Add these two in addition it at the end)