Skip to content
Related Articles

Related Articles

How to Add Support Library to Android Studio Project?

View Discussion
Improve Article
Save Article
  • Difficulty Level : Hard
  • Last Updated : 23 Jun, 2021
View Discussion
Improve Article
Save Article

An android support library is part of Android SDK tools. You can use the Android Support Library for backward-compatible versions of new Android features and additional UI elements and features not included in the standard Android framework. Each package in the support library has a version number in three parts (X.Y.Z) that correspond to an Android API level, and a particular library revision For example, a support library version number of 22.3.4 is version 3.4 of the support library for API 22.

As a general rule, use the most recent version of the support library for the API your app is compiled and targeted for, or a newer version. For example, if your app targets API 25, use version 25.X.X of the support library.

Download the Support Library

Step 1: In Android Studio, select Tools > Android > SDK Manager, or click the SDK Manager icon. The SDK Manager preference pane appears.

Step 2: Click the SDK Tools tab and expand the Support Repository.

Step 3: Look for Android Support Repository in the list.

  • If Installed appears in the Status column, you’re all set. Click Cancel.
  • If Not installed or Update Available appears, click the checkbox next to Android Support Repository. A download icon should appear next to the checkbox. Click OK.

Step 4: Click OK again, and then Finish when the support repository has been installed.

Add the Dependency to Your build.gradle File

The Gradle scripts for your project manage how your app is built, including specifying your app’s dependencies on other libraries. To add a support library to your project, modify your Gradle build files to include the dependency to that library you found in the previous section.

Step 1: In Android Studio, make sure the Project pane is open and the Android tab is clicked.

Step 2: Expand Gradle Scripts, if necessary, and open the build.gradle (Module: app) file. Note that build.gradle for the overall project (build.gradle (Project: app_name) is a different file from the build.gradle for the app module.

Step 3: Locate the dependencies section of build.gradle, near the end of the file. The dependencies section for a new project may already include dependencies in several other libraries.

Step 4: Add a dependency for the support library that includes the statement you copied in the previous task. For example, a complete dependency on the design support library looks like this:

compile ''

Step 5: Update the version number, if necessary. If the version number you specified is lower than the currently available library version number, Android Studio will warn you that an updated version is available. (“a newer version of is available”). Edit the version number to the updated version, or type Shift+Enter and choose “Change to XX.X.X” where XX.X.X is the updated version number.

Step 6: Click Sync Now to sync your updated Gradle files with the project, if prompted.

Your Gradle file will look something like this in the above picture.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!