我使用Eclipse和Android。我创建了一个新项目,我在java类中有以下错误
import android.support cannot resolved.
这是我的SDK管理器屏幕
我安装了Android支持存储库。
我想将android-support-v7.jar添加到我的项目中。但我没有文件夹 机器人-的SDK \额外\机器人\支持\ V7 \
我有文件夹
android-sdk\extras\android\m2repository\com\android\support
是同一个文件夹吗?如何将android-support-v7.jar添加到我的Eclipse项目中?
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')
}
}
答案 0 :(得分:0)
怀疑您还使用maven作为构建工具,将m2repository
添加到项目中,如:
<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>
参考:Android support library setup with maven
您必须相应地调整env.ANDROID_HOME
和artifactId
,version
。