找不到com.google.android.gms:play-services:7.3.0

时间:2015-06-12 20:23:08

标签: android android-gradle build.gradle

我从Android Studio gradle获取此日志:

Error:A problem occurred configuring project ':ParseStarterProject'.
> Could not resolve all dependencies for configuration ':ParseStarterProject:_debugCompile'.
   > Could not find com.google.android.gms:play-services:7.5.0.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services/7.5.0/play-services-7.5.0.pom
         https://repo1.maven.org/maven2/com/google/android/gms/play-services/7.5.0/play-services-7.5.0.jar
     Required by:
         Parse:ParseStarterProject:unspecified

世界上怎么看不到它本地的位置(其他项目清楚地看到并正常编译)?

    apply plugin: 'com.android.application'
apply plugin: 'com.parse'

buildscript {
  repositories {
    mavenCentral()
      jcenter()
    maven { url 'https://maven.parse.com/repo' }
  }
  dependencies {
    classpath 'com.parse.tools:gradle:1.+'
  }
}

dependencies {
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.parse.bolts:bolts-android:1.2.0'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile fileTree(dir: 'libs', include: 'ParseCrashReporting-*.jar')
}

android {
    compileSdkVersion 22
    buildToolsVersion "20"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 22
    }

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

/* Uncomment if you enable ProGuard and you want to automatically upload symbols on build.
parse {
  applicationId YOUR_APPLICATION_ID
  masterKey YOUR_MASTER_KEY

  // Make symbol upload automatic. Otherwise, use e.g. ../gradlew parseUploadSymbolsDebug;
  uploadSymbols true
}
*/
你的意思是?有两个,所以我把它放在一个案例中。

编辑:build.gradle(模块)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

ext {
    compileSdkVersion = 22
    buildToolsVersion = "22"

    minSdkVersion = 9
    targetSdkVersion = 22
}

5 个答案:

答案 0 :(得分:27)

打开SDK Manager并更新 Google Play服务 Google存储库。它适用于我。

enter image description here

答案 1 :(得分:3)

我今天遇到了同样的问题:我只是通过更新谷歌存储库来解决: 工具 - > android-> SDK管理器 - >附加功能。更新后,您应该能够导入使用依赖

答案 2 :(得分:1)

您必须按照docs

中的说明在Android Studio中下载相应的SDK包

<强>步骤:

  1. 工具 - &gt; Android - &gt; SDK Manager
  2. 选择 Google Play服务
  3. 安装

答案 3 :(得分:0)

在我的案例中,Android Studio表示Play Services 9.4.2可用,我也遇到了同样的错误。然后我改为版本9.4.0,这在官方文档中有说明。错误消失了。

答案 4 :(得分:0)

我遇到了像昨天一样的问题,似乎没有任何效果:我的Android支持存储库和Google Play服务最新,一切......

在查找android sdk文件夹时,环境变量ANDROID_HOME指向错误的文件夹。要改变它,我必须在我的MacBook根目录的.profile文件中设置它。

以下是执行此操作的语法:export ANDROID_HOME =&#39; / Users / SteeveO / Library / Android / sdk&#39;

希望将来帮助某人!