4

I have imported one project into Android Studio but I got the error:

Could not find com.android.support:support-v4:19.1.0.

Where could I find this file? I have imported the project using Gradle.

I have the Android Studio version 0.5.7 the last android sdk and java 1.7u55.

9 Answers 9

8

Just add this code to you build.gradle file

dependencies {
    compile 'com.android.support:support-v4:19.+'
}

and press Tools -> Android -> Sync Project with Gradle Files

Gradle will download necessary files by himself

3
  • where exactly to add this? Jun 18, 2014 at 14:02
  • No such property: compile for class: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
    – coolaj86
    Jun 27, 2014 at 19:25
  • 2
    In The SDK Manager, I had to install the Android Support Repository AND the Android Support Library. Aug 2, 2014 at 23:29
2

It does not work for me either. It works with 19.0.1 But if (I use gradle) I do this in my build.gradle:

repositories {
    def androidHome = System.getenv("ANDROID_HOME")
    mavenCentral()
    maven {
        url "$androidHome/extras/android/m2repository/"
    }
}

It finds the artifact.

1
  • I also found the root cause. If I use classpath 'com.android.tools.build:gradle:0.10.1' it does not work, but if I use classpath 'com.android.tools.build:gradle:0.9.1' it works.
    – dfritsi
    May 3, 2014 at 23:04
2

From the SDK Manager, delete and re-install the Android Support Library 19.1 package.

1

I had this same problem with morning. I found the Jar file that I needed in /<MySdkFolder>/extras/android/support/ - in there are some sub folders with the different support libraries in them, so the last part of the path depends on which one that you want to use.

I just copied this into the lib folder of the project. I'm sure there is a more technical solution but it worked for me.

0

Following theory works at me:

Android Studio has problems importing support-v4:19.1.+ library when it comes through a transitive dependency.

Solution Adding support-v4 as own dependency and exclude this lib where it comes transitive. then i could not more see this import issue

0

Right clicking on the library and select the import as library option from the context menu works for me.

0

Try to go

Project Structure -> Dependencies -> Add : then select -> File dependecies

then select the proper library

0

This artifact is available on google maven repository. So need to add following in the build.gradle:

allprojects {
    repositories {
        mavenLocal()
        google()
    }
}
0

I had a similar problem. This line to build.gradle works --> implementation 'com.android.support:support v4:28.0.0'

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.