Add support library to Android Studio project

All we need is an easy explanation of the problem, so here it is.

I just installed the new Android Studio and I’m looking for a way to import the support library for Android.

Where is the option for that? In Eclipse that are just two clicks. I googled for it but found nothing. Surely it is too new.

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1


Since Android Studio introduce a new build system: Gradle. Android developers can now use a simple, declarative DSL to have access to a single, authoritative build that powers both the Android Studio IDE and builds from the command-line.

Edit your build.gradle like this:

apply plugin: 'android'

    android {
        compileSdkVersion 19
        buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 18
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"

    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile ''

NOTES: Use + in compile '' so that gradle can always use the newest version.


Because Android Studio is based on IntelliJ IDEA, so the procedure is just same like on IntelliJ IDEA 12 CE

1.Open Project Structure (Press F4 on PC and Command+; on MAC) on your project).

2.Select Modules on the left pane.

3.Choose your project and you will see Dependencies TAB above the third Column.

4.Click on the plus sign in the bottom. Then a tree-based directory chooser dialog will pop up, navigate to your folder containing android-support-v4.jar, press OK.

5.Press OK.

Method 2

I no longer work on Android project for a while.
Although the below provides some clue to how an android studio project can be configured, but I can’t guarantee it works flawlessly.

In principle, IntelliJ respects the build file and will try to use it to configure the IDE project. It’s not true in the other way round, IDE changes normally will not affect the build file.

Since most Android projects are built by Gradle,
it’s always a good idea to understand this tool.

I’d suggest referring to @skyfishjy’s answer, as it seems to be more updated than this one.

The below is not updated

Although android studio is based on IntelliJ IDEA, at the same time it relies on gradle to build your apk. As of 0.2.3, these two doesn’t play nicely in term of configuring from GUI.
As a result, in addition to use the GUI to setup dependencies, it will also require you to edit the build.gradle file manually.

Assuming you have a Test Project > Test structure.
The build.gradle file you’re looking for is located at TestProject/Test/build.gradle

Look for the dependencies section, and make sure you have

compile ‘’

Below is an example.

buildscript {
    repositories {
    dependencies {
        classpath ''
apply plugin: 'android'

repositories {

dependencies {
    compile ''

android {
    compileSdkVersion 18
    buildToolsVersion "18.0.1"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16

You can also add 3rd party libraries from the maven repository

compile group: ‘’, name: ‘gson’, version: ‘2.2.4’

The above snippet will add gson 2.2.4 for you.

In my experiment, it seems that adding the gradle will also setup correct IntelliJ dependencies for you.

Method 3

This is way more simpler with Maven dependency feature:

  1. Open File -> Project Structure… menu.
  2. Select Modules in the left pane, choose your project’s main module in the middle pane and open Dependencies tab in the right pane.
  3. Click the plus sign in the right panel and select “Maven dependency” from the list. A Maven dependency dialog will pop up.
  4. Enter “support-v4” into the search field and click the icon with magnifying glass.
  5. Select “[email protected]” from the drop-down list.
  6. Click “OK”.
  7. Clean and rebuild your project.

Hope this will help!

Method 4

You can simply download the library which you want to include and copy it to libs folder of your project. Then select that file (in my case it was android-support-v4 library) right click on it and select “Add as Library”

Method 5

In Android Studio 1.0, this worked for me :-

Open the build.gradle (Module : app) file and paste this (at the end) :-

dependencies {
    compile ""

Note that this dependencies is different from the dependencies inside buildscript in build.gradle (Project)

When you edit the gradle file, a message shows that you must sync the file. Press “Sync now”

Source :

Method 6

Android no longer downloading the libraries from the SDK manager, it has to be accessed through Google’s Maven repository.

You will have to do something similar to this in your build.gradle file:

allprojects {
    repositories {
        maven {
            url ""

dependencies {
    compile ""

Find more details about the setting up process here and about the different support library revisions here.

Method 7


implementation 'androidx.appcompat:appcompat:1.0.2'  

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply