0

When I Sync Project with Gradle Files the support library support-v4-19.1.0 appears automatically in my External Libraries. Can someone explain to me what is happening here and why? Is it telling me that I need to include this in my dependencies? Or are External Libraries automatically included in my project? Here is my app.gradle file:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1'

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 7
        versionName "3.4"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
}

dependencies {
    compile 'com.google.android.gms:play-services:5.0.89'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

These are the 3 libraries in my External Libraries:

  • Android API 19 Platform
  • JDK (1.7)
  • support-v4-19.1.0

I understand why the first two are there, but not the third. The first two stay during a Gradle sync, but the 3rd disappears and then reappears. Sorry if this is a rookie question and thanks for taking a look!

2 Answers 2

2

Don't worry about what appears in your External Libraries folder in the project view. What goes into your Gradle build files is what you need to concentrate on in configuring your project. This folder is a leftover of Android Studio's IntelliJ origin but has lost some of its usefulness in a Gradle-based project. The support library is coming in as a transitive dependency from the Play Services library. If you look at Play Service's pom file in $SDK_HOME/extras/google/m2repository/com/google/android/gms/play-services/5.0.89/play-services-5.0.89.pom you can see it:

  <dependencies>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-v4</artifactId>
      <version>19.1.0</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
1
  • I suspected it had something to do with Play Services, but wanted to make sure. Thanks for the explanation. Sep 16, 2014 at 19:29
1

No action needed

Android Studio is letting you know that it is adding it for backward compatibility for the classes you've referred to in your java code.

External Libraries is a section where AS lists all the recognized and added libraries. So it has already been included in your project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.