"找不到与com.google.android.gms匹配的任何版本:play-services-basement:[15.0.1,16.0.0)"

时间:2018-06-14 20:49:51

标签: android google-maps android-studio-3.1 android-googleapiclient

我的项目工作正常,但今天,当我尝试重建它时,开始显示上述错误。我检查了以前对类似问题的答案,但无法解决问题。这是build.gradle(Module:app)文件。

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "soumyadeb.com.mywatercan"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    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'
    })

    implementation 'com.android.support:appcompat-v7:25.0.0'
    implementation 'com.android.support:design:25.0.0'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation "com.google.android.gms:play-services-places:15.0.1"
    implementation "com.google.android.gms:play-services-location:15.0.1"
    implementation "com.google.android.gms:play-services-auth:15.0.1"
    implementation "com.google.android.gms:play-services-base:15.0.1"

    testCompile 'junit:junit:4.12'
} 

以下是我的build.gradle(项目:..)

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

buildscript {
    repositories {
        google()
        mavenLocal()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:3.2.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
}

我收到此错误。 enter image description here

2 个答案:

答案 0 :(得分:1)

在build.gradle中添加google()

allprojects {
    repositories {
        jcenter()
        google()
    }

答案 1 :(得分:0)

尝试implementation 'com.google.android.gms:play-services-vision:15.0.1'所有播放服务 而且我认为我们在Project build.gradle

中需要classpath 'com.google.gms:google-services:3.2.0'