错误(28,13):无法解决:com.google.android.gms:play-services:10.0.1

时间:2016-12-25 07:53:02

标签: android google-maps android-studio google-api

我想使用Google地图。 我的问题:

android-Studio 2.2,android-SDK 4.4,gradle:2.2.2,我的操作系统:win-10

    apply plugin: 'com.android.application'
android {
        compileSdkVersion 'Google Inc.:Google APIs:21'
        buildToolsVersion "23.0.3"
        defaultConfig {
            applicationId "ir.amir.map"
            minSdkVersion 19
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:23.3.0'
        testCompile 'junit:junit:4.12'
        compile 'com.google.android.gms:play-services:10.0.1'
    }

IMG:

enter image description here

2 个答案:

答案 0 :(得分:0)

检查您是否已将存储库添加到存储在根文件夹中的 build.gradle 文件中。

尝试添加mavenCentral()jcenter()

例如:

<强>的build.gradle

// ...
buildscript {
    repositories {
        mavenCentral()
    }
}
// ...

您还可以简化以下操作:

compileSdkVersion 'Google Inc.:Google APIs:21'

compileSdkVersion 21

答案 1 :(得分:0)

单击错误中的Install Repository and sync project选项。 SDK管理器将安装缺少的存储库。

相关问题