摇篮构建失败找谷歌播放服务在Android的工作室 [英] Gradle build fails looking for Google Play Services in Android Studio

查看:156
本文介绍了摇篮构建失败找谷歌播放服务在Android的工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Android的工作室0.3.6运行我的项目,但我总是得到这个错误:

I'm trying to run my project in Android Studio 0.3.6, but I always get this error :

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

下面是我的完整 build.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'
}

最后,我的SDK管理器:

And finally, my SDK Manager :

我试图与Android工作室(0.2.8,0.2.9,0.2.13,0.3.2,0.3.6)的许多版本,它的总是相同的。我试图改变播放服务的版本,我试图改变依赖的秩序,没有什么做的伎俩。

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.

有什么用我的设置不正确吗?我找了答案,pretty的每样东西,我发现( build.gradle 结构,SDK缺项)已经很好...

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...

推荐答案

我终于发现是什么问题。 gnuf我指出了正确的方向。但问题是,Android的工作室,在项目结构|平台设置| Android SDK中,表现出了错误的SDK。这表明其使用的SDK是 C:/ Program Files文件(86)/安卓/ Android的工作室/ SDK ,但事实上,我发现它试图建立与其他SDK位于 C:\ Users \用户my_username \应用程序数据\本地\机器人\机器人工作室\ SDK

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.

不用说,它没有工作。有没有安装此SDK。所以我复制 C的内容:/程序文件(x86)/安卓/ Android的工作室/ SDK C:\ Users \用户my_username \ AppData的\本地\机器人\机器人工作室\ 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.

所以,我认为这是机器人工作室的一个bug。如果有人运行到这个问题,请确保你只有一个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的工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆