Android Studio无法找到我的Google Play服务

时间:2015-08-04 20:21:06

标签: android-studio google-play-services

我一直在跟踪演练,并在几个小时内查看了问题,我尝试过的任何事情都没有让我得到答案。我应该在哪里看下一个?

错误

Error:Could not find com.google.gms:google-services:1.3.0-beta1.
Searched in the following locations:
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.pom
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.jar
    https://maven.fabric.io/public/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.pom
    https://maven.fabric.io/public/com/google/gms/google-services/1.3.0-beta1/google-services-1.3.0-beta1.jar
Required by:
    MyApp:myApp:unspecified

MyApp Gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.google.gms:google-services:1.3.0-beta1'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 21
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "android.phone.MyApp"
        minSdkVersion 13
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':comcrashlyticssdkandroid_crashlytics_2')
    compile 'com.android.support:support-v4:+' // updated
    compile 'com.google.android.gms:play-services-analytics:+' // updated
    compile 'com.google.android.gms:play-services-gcm:+' // updated
    compile "com.google.android.gms:play-services:+"
}

SDK Extras

enter image description here

2 个答案:

答案 0 :(得分:15)

jcenter()包含Android库,您需要将其添加到您的存储库。

buildscript {
    repositories {
        jcenter();
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'com.google.gms:google-services:1.3.0-beta1'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

repositories {
    jcenter();
    maven { url 'https://maven.fabric.io/public' }
}

答案 1 :(得分:0)

//Add the dependency to your project's top-level build.gradle:
classpath 'com.google.gms:google-services:1.3.0-beta1'

//Add the plugin to your app-level build.gradle:
apply plugin: 'com.google.gms.google-services'

//Set Up Google Play Services
dependencies {
  compile "com.google.android.gms:play-services:7.5.+"
}