'How can I make AndroidX the default library for new Android projects?

Google now recommends using the AndroidX libraries over the older support libraries (read here), yet each time I start a new Android project in Android studio, it defaults to the support libraries dependencies. Since AndroidX is what is recommended, I'm guessing there must be some way to default to AndroidX?

Right now I need to manually configure the gradle.properties file for each new project, as below

From the AndroidX Documentation:

If you want to use AndroidX in a new project, you need to set the compile SDK to Android 9.0 (API level 28) or higher and set both of the following Android Gradle plugin flags to true in your gradle.properties file.
android.useAndroidX: When set to true, the Android plugin uses the appropriate AndroidX library instead of a Support Library. The flag is false by default if it is not specified.
android.enableJetifier: When set to true, the Android plugin automatically migrates existing third-party libraries to use AndroidX by rewriting their binaries. The flag is false by default if it is not specified.

Is there a way to make Android Studio use only AndroidX by default?



Solution 1:[1]

AndroidX is enabled by default. In fact, in the latest version of Android Studio, you don't even have the option to deselect the AndroidX dependencies. See here:

Sample Project

The androidx.* artifacts are already selected. If your Android Studio doesn't support this, try updating it or installing it again. Make sure to not import the older preferences from your IDE. It will refresh your IDE.

Solution 2:[2]

when u create any new project in android studio in the latest version then it will by default open with androidX library.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Sourav Maurya