Reputation: 302
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?
Upvotes: 2
Views: 1629
Reputation: 49
when u create any new project in android studio in the latest version then it will by default open with androidX library.
Upvotes: 1
Reputation: 2412
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:
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.
Upvotes: 4