0

I work with Eclipse and Android. I created a new project and I have the following error in a java class

import android.support cannot resolved.

This is my SDK manager screen

enter image description here

I installed Android Support Repository.

I want to add android-support-v7.jar to my project. But I don't have folder android-sdks\extras\android\support\v7\

I have the folder

android-sdk\extras\android\m2repository\com\android\support

Is the same folder? How can I add android-support-v7.jar to my Eclipse project?

EDITED

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
    }
}
apply plugin: 'com.android.application'

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

android {
    compileSdkVersion 19
    buildToolsVersion "25.0.2"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}
Carlota
  • 1,239
  • 3
  • 29
  • 59

1 Answers1

0

Suspecting you are also using maven as your build tool, add the m2repositoryto your project like:

<repositories>
    <repository>
        <id>android-support</id>
        <url>file://${env.ANDROID_HOME}/extras/android/m2repository</url>
    </repository>
</repositories>
    ......
<dependency>
    <groupId>com.android.support</groupId>
    <artifactId>support-v4</artifactId>
    <version>19.0.1</version>
</dependency>

ref: Android support library setup with maven

you have to adjust env.ANDROID_HOME and artifactId, version accordingly.

sschrass
  • 7,014
  • 6
  • 43
  • 62
  • I don't understand why when I installed from SDK Manager Android Support Repository I don't have the folder \extras\android\support\v7. I don't want to use Maven. – Carlota Dec 27 '16 at 13:21
  • The Support Repository *is* the place where SDK-dependencies live. If you do not use maven, then add the repositores to your top-level build.gradle and the dependecies to the corresponding module (the app). – sschrass Dec 27 '16 at 13:29
  • I created build.grade. Name's project is Ejemplo2. I edited in my question build.grade. What do I have to do? – Carlota Dec 27 '16 at 13:47