Android Studio 2.2.2: Failed to resolve Google Play-Services

前提是你 提交于 2019-12-24 05:47:09

问题


I was trying to create a demo project based on Google Map, for this I was using MapsActivity provided by android studio. Everything is fine excluding the Google Play services. Android studio is failed to resolve play-services and throwing an error-

Error:(27, 13) Failed to resolve: com.google.android.gms:play-services:9.4.0
Install Repository and sync project
Show in File
Show in Project Structure dialog

Project Gradle

 // Top-level build file where you can add configuration options common to all sub-projects/modules.

 buildscript {
 repositories {
    jcenter()
 }
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.2'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
 }
}

allprojects {
 repositories {
    jcenter()
 }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

App Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.example.mymapapplication"
        minSdkVersion 15
        targetSdkVersion 24
        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(dir: 'libs', include: ['*.jar'])
    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:24.2.1'
    compile 'com.google.android.gms:play-services:9.4.0'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

I have the updated sdk tools Google Play services v-33 and Google Repository v-36. I tried many things to handle it, but still facing the same problem.


回答1:


Resolved the issue, it was a bug on the repository link.

"Install Google Repository" failed.
 Failed packages:
- Google Repository (extras;google;m2repository)

Now the new link- https://dl.google.com/android/repository/google_m2repository_gms_v7_rc28_wear_2a3.zip(at this time) working fine, I updated my google repository and google play-services and its work like a charm.



来源:https://stackoverflow.com/questions/40226233/android-studio-2-2-2-failed-to-resolve-google-play-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!