Home Tutorials Training Consulting Products Books Company Donate Contact us

Online training


Quick links


(c) 2014, 2017 vogella GmbH Version 0.5, 10.07.2017

This tutorial describes how to use (and how to avoid the usage) of the Android support library.

1. Using are the AndroidX libraries from Google

1.1. What is AndroidX or the support libraries

The AndroidX library package is a set of code libraries that provide backward-compatible enhancements of the Android framework. They also features and widgets that are only available through the library APIs. Each AndroidX library is backward-compatible to a specific Android API level.

In general you find two types of libraries. The first type provides framework functionality for older API releases, the second type provides new functionality for all devices. Decoupling the libraries from the core Android platform allow Google to enhance them on a faster pace.

The AndroidX library used to be called support libraries.

1.2. Install support library

The support library allows you to use additional functionality. This functionality might be provided by higher Android API levels. It also provides functionality that is unbundled from Android, for example the RecyclerView widget for efficient list display.

Android provides several versions of the support libraries. These are valid as of the respective API level of Android. For example, the support library v7 works as of Android devices with version API 7. Higher versions of the support library require also the lower versions to work. For example, support the v7 library requires the v4 library.

1.3. The support libraries from Google

You have different components here. At the time of this writing you have:

Table 1. Support library versions
Support Library Description Gradle dependency

v4 Support Library

Designed for Android 1.6 (API level 4) or higher. Includes lots of things including support for Fragments and the Loader framework.

Located in the android-sdk/extras/android/support/v7/appcompat/ directory.

v7 Support Libraries

Set of libraries which require Android 2.1 (API level 7) and higher. Requires also the v4 Support library.

v7 appcompat library

Adds support for the Action Bar. Includes also support for material design user interface.

Located in the android-sdk/extras/android/support/v7/appcompat/

v7 cardview library

Adds support for the CardView widget.


v7 recyclerview library

Adds support for the RecyclerView widget.

compile "com.android.support:recyclerview-v7:24.0.0"

Design library to support material design

Adds support for material design applications

compile 'com.android.support:design:24.0.0'

To see a complete list of the available libraries see http://developer.android.com/tools/support-library/features.html.

2. Remove usage of the support library from a new project

2.1. Why would you remove the support library?

Support libraries are changing very fast therefore it is hard to create a "stable" description how to use them. Also unfortunately the templates of Android studio for generating Android projects are changing all the time. This make testing a new feature or standard API harder. It also makes it harder to follow a tutorial.

2.2. Converting a project to a standard Android project

The build dependency in the Gradle build file does not hurt but you need to remove the references to the compatibility library from your code and your resources.

For this, change the code of the generated activity to extend Activity instead of any other activity like AppCompatActivity. Also, reduces the example code to the minimum. The following is an example for an activity called MainActivity.

package com.vogella.android.myapplicationsdf;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

    protected void onCreate(Bundle savedInstanceState) {

Also ensures that only standard elements are using the generated layout file. The following is an example listing for a simple standard layout file.

Changing the styles file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

        android:text="Hello World!" />

Also ensure that the theme is a default theme, instead of the compatibility theme. For this check the app/res/values/styles.xml folder to use the standard material theme.

Changing the styles file

    <!-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>


3. Android ActionBar Resources

4. vogella training and consulting support

Copyright © 2012-2018 vogella GmbH. Free use of the software examples is granted under the terms of the Eclipse Public License 2.0. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.