What is AndroidX? Explaining the Android development support library

Posted on May 24, 2022

Learn what AndroidX is and how it works


AndroidX is an Android development support library. It was created for the purpose of helping Android developers bring the latest Android features to older Android versions.

With AndroidX, developers will be able to make their Android applications compatible with as many Android versions supported by the library.

AndroidX includes essential libraries for Android application development, including testing and layout libraries.

It’s an upgraded version of the old Android Support Library, which is no longer maintained.

When you create a new application with the latest Android Studio version, androidx is already included in the project by default.

Consider the following example:

dependencies {
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.6.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

As you can see, several libraries like appcompat, constraintlayout, and espresso are using the androidx namespace.

The libraries will be used in your application as follows:

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    // ...
}

Compare the dependencies list above with the old Android app project below:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:design:23.3.0'
}

The old support library uses the com.android.support for the package, but the namespace uses android.support as shown below:

import android.support.v7.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    // ...
}

In AndroidX, the namespace for the libraries is consistent.

All features available in the old support library are also available in AndroidX, and new features will be added there.

If your Android project is still using the old support library, there’s a migration guide that helps you start using AndroidX.

Now you’ve learned what AndroidX is and how to start using it.

Level up your programming skills

I'm sending out an occasional email with the latest programming tutorials. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.