【发布时间】:2013-11-26 07:34:54
【问题描述】:
我正在使用带有外部 Android SDK 的 Android Studio。我已经安装了支持库和支持存储库。支持存储库位于:
~/Development/Tools/android/sdk/extras/android/m2repository
当我在build.gradle 文件中向支持库添加依赖项时,例如:
...
repositories {
mavenCentral()
}
...
dependencies {
compile "com.android.support:support-v4:18.0.+"
}
Android Studio 找不到支持库(无法解析符号等),Gradle 也找不到这些库:
Gradle: A problem occurred configuring project ':TestAndroidStudio'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':TestAndroidStudio:_DebugCompile'.
> Could not find any version that matches com.android.support:support-v4:18.0.+.
Required by:
TestAndroidStudio:TestAndroidStudio:unspecified
如何在 Android Studio 和/或 build.gradle 文件中指定 Android 支持存储库的位置?
【问题讨论】:
-
local.properties文件中的 SDK 路径是否正确? -
我的
local.properties文件中唯一的一行是:sdk.dir=/Users/jaap/Development/Tools/android/sdk这是外部sdk 的路径。 -
你确定你有支持库版本 18 吗?现在是 19 岁。
-
任何人因为未能向 build.gradle 添加 'compile' 语句而到达这里,请注意有两个 build.gradle 文件,并且必须将编译添加到没有依赖项部分的文件的依赖项部分(targetSdkVersion = x 等的那个)
标签: android gradle android-studio android-support-library android-gradle-plugin