I'm trying to run my project in Android Studio 0.3.6, but I always get this error :
我试着在Android Studio 0.3.6中运行我的项目,但是我总是得到这个错误:
Gradle: A problem occurred configuring root project 'myapp_android'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':_DebugCompile'.
> Could not resolve com.google.android.gms:play-services:3.1.36.
Required by:
:myapp_android:unspecified
> Could not GET 'http://maven.hq.couchbase.com/nexus/content/repositories/releases/com/google/android/gms/play-services/3.1.36/play-services-3.1.36.pom'. Received status code 503 from server: Service Temporarily Unavailable
Here is my complete build.gradle
file :
这是我的完整版本。gradle文件:
home = System.getenv("ANDROID_HOME")
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
maven {
url "http://maven.hq.couchbase.com/nexus/content/repositories/releases/"
}
maven {
url "http://files.couchbase.com/maven2/"
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.+'
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.google.android.gms:play-services:3.1.36'
compile 'com.couchbase.cblite:CBLite:1.0.0-beta'
compile 'com.couchbase.cblite:CBLiteEktorp:1.0.0-beta'
compile 'com.couchbase.cblite:CBLiteJavascript:1.0.0-beta'
compile fileTree(dir: 'libs', include: '*.jar')
instrumentTestCompile 'com.jayway.android.robotium:robotium-solo:4.3'
}
android {
compileSdkVersion 18
buildToolsVersion "18.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
tasks.withType(Compile) {
options.encoding = 'UTF-8'
}
And finally, my SDK Manager :
最后,我的SDK管理器:
I tried with many versions of Android Studio (0.2.8, 0.2.9, 0.2.13, 0.3.2, 0.3.6) and it's always the same. I tried changing the Play Services version, I tried changing the order of the dependencies, nothing did the trick.
我试用了许多版本的Android Studio(0.2.8, 0.2.9, 0.2.13, 0.3.2, 0.3.6),结果总是一样的。我尝试过改变Play服务版本,我尝试过改变依赖项的顺序,但没有什么是成功的。
Is there something not correct with my setup? I looked for answers and pretty much everything I found (build.gradle
structure, SDK missing items) was already fine...
我的设置有问题吗?我寻找答案和几乎所有我找到的(构建)。等级结构,SDK缺失项)已经很好了…
3 个解决方案
#1
7
I finally found what was the problem. @gnuf pointed me in the right direction. But the problem was that Android Studio, in Project Structure | Platform Settings | Android SDK, showed the wrong SDK. It showed the SDK it used was C:/Program Files (x86)/Android/android-studio/sdk
, but in fact, I discovered it tried to build with another SDK located in C:\Users\my_username\AppData\Local\Android\android-studio\sdk
.
我终于找到了问题所在。@gnuf为我指明了正确的方向。但问题是Android Studio在项目结构|平台设置| Android SDK中显示了错误的SDK。它显示SDK以前是C:/程序文件(x86)/ Android / android-studio / SDK,但事实上,我发现它试图构建与另一个SDK位于C:\Users\ my_username \ AppData \本地Android \ android-studio \ \ SDK。
Needless to say, it didn't work. There was nothing installed in this SDK. So I copied the contents of C:/Program Files (x86)/Android/android-studio/sdk
to C:\Users\my_username\AppData\Local\Android\android-studio\sdk
and it worked! My first build in three weeks.
不用说,它不起作用。这个SDK中没有安装任何东西。所以我复制的内容C:/程序文件(x86)/ Android / android-studio / sdk C:\Users\ my_username \ AppData \本地Android \ android-studio \ \ sdk,它成功了!我三周内的第一次构建。
So I think it's a bug of Android Studio. If anyone runs into this problem, make sure you only have one SDK on your computer. If you have more than one, make sure they all have the required dependencies. If you can, just copy the content of the most up to date to the others.
所以我认为这是Android Studio的一个缺陷。如果有人遇到这个问题,请确保您的计算机上只有一个SDK。如果您有多个依赖项,请确保它们都具有所需的依赖项。如果可以的话,就把最新的内容复制给其他的。
#2
2
It may be the case that the location where you've installed the SDK components is different than the one that Android Studio is using.
可能安装SDK组件的位置与Android Studio使用的位置不同。
Can you verify that the local Maven repositories (installed by the Google Repository and Android Support Repository) are under the Android SDK that you're using in your Android Studio project?
您能否验证本地Maven储存库(由谷歌储存库和Android Support储存库安装)是否位于您在Android Studio项目中使用的Android SDK之下?
In Android Studio, go to Project Structure | Platform Settings | Android SDK. (On my machine, the path for Android SDK Location is /opt/boxen/homebrew/Cellar/android-sdk/22.2.1
) In that directory, ensure that the subdirectory extras/google/m2repository/com/google/android/gms/play-services/
exists.
在Android Studio中,进入项目结构|平台设置| Android SDK。(在我的机器上,Android SDK位置的路径是/opt/boxen/homebrew/Cellar/ Android - SDK /22.2.1)在那个目录中,确保subdirectory extras/谷歌/m2repository/com/ android/play- services/ exist。
#3
-1
It looks for Google dependencies like Google Play Services in your SDK extras, not in Maven repositories over the network. Install the "Google Repository" in your SDK manager and you should be good to go.
它寻找谷歌依赖项,如谷歌在SDK附加部分中运行服务,而不是在网络上的Maven存储库中。在您的SDK管理器中安装“谷歌存储库”,您应该很好。
#1
7
I finally found what was the problem. @gnuf pointed me in the right direction. But the problem was that Android Studio, in Project Structure | Platform Settings | Android SDK, showed the wrong SDK. It showed the SDK it used was C:/Program Files (x86)/Android/android-studio/sdk
, but in fact, I discovered it tried to build with another SDK located in C:\Users\my_username\AppData\Local\Android\android-studio\sdk
.
我终于找到了问题所在。@gnuf为我指明了正确的方向。但问题是Android Studio在项目结构|平台设置| Android SDK中显示了错误的SDK。它显示SDK以前是C:/程序文件(x86)/ Android / android-studio / SDK,但事实上,我发现它试图构建与另一个SDK位于C:\Users\ my_username \ AppData \本地Android \ android-studio \ \ SDK。
Needless to say, it didn't work. There was nothing installed in this SDK. So I copied the contents of C:/Program Files (x86)/Android/android-studio/sdk
to C:\Users\my_username\AppData\Local\Android\android-studio\sdk
and it worked! My first build in three weeks.
不用说,它不起作用。这个SDK中没有安装任何东西。所以我复制的内容C:/程序文件(x86)/ Android / android-studio / sdk C:\Users\ my_username \ AppData \本地Android \ android-studio \ \ sdk,它成功了!我三周内的第一次构建。
So I think it's a bug of Android Studio. If anyone runs into this problem, make sure you only have one SDK on your computer. If you have more than one, make sure they all have the required dependencies. If you can, just copy the content of the most up to date to the others.
所以我认为这是Android Studio的一个缺陷。如果有人遇到这个问题,请确保您的计算机上只有一个SDK。如果您有多个依赖项,请确保它们都具有所需的依赖项。如果可以的话,就把最新的内容复制给其他的。
#2
2
It may be the case that the location where you've installed the SDK components is different than the one that Android Studio is using.
可能安装SDK组件的位置与Android Studio使用的位置不同。
Can you verify that the local Maven repositories (installed by the Google Repository and Android Support Repository) are under the Android SDK that you're using in your Android Studio project?
您能否验证本地Maven储存库(由谷歌储存库和Android Support储存库安装)是否位于您在Android Studio项目中使用的Android SDK之下?
In Android Studio, go to Project Structure | Platform Settings | Android SDK. (On my machine, the path for Android SDK Location is /opt/boxen/homebrew/Cellar/android-sdk/22.2.1
) In that directory, ensure that the subdirectory extras/google/m2repository/com/google/android/gms/play-services/
exists.
在Android Studio中,进入项目结构|平台设置| Android SDK。(在我的机器上,Android SDK位置的路径是/opt/boxen/homebrew/Cellar/ Android - SDK /22.2.1)在那个目录中,确保subdirectory extras/谷歌/m2repository/com/ android/play- services/ exist。
#3
-1
It looks for Google dependencies like Google Play Services in your SDK extras, not in Maven repositories over the network. Install the "Google Repository" in your SDK manager and you should be good to go.
它寻找谷歌依赖项,如谷歌在SDK附加部分中运行服务,而不是在网络上的Maven存储库中。在您的SDK管理器中安装“谷歌存储库”,您应该很好。