错误:无法解决:com.google.android.gms

时间:2017-09-25 10:48:18

标签: android google-play-services google-location-services

错误:无法解决:com.google.android.gms:play-services-basement:[11.0.4]

错误:无法解决:com.google.android.gms:play-services-tasks:[11.0.4]

enter image description here

enter image description here

enter image description here

当我使用android studio 2.3.2版本时,我的项目构建成功,但在更新到android studio版本到2.3.3并更新了google play服务后,我收到此错误请帮助。

我的文件夹

中没有play-services-basement和play-services-tasks文件夹

当我对此进行评论"编译com.google.android.gms:play-services-location:11.0.4'"如果我取消注释然后我的项目没有编译

,我的项目编译正常

Project Gradle文件:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

allprojects {
    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    repositories {
        jcenter()
    }
}

ext {

    compileSdkVersion = 25
    buildToolsVersion = "25.0.2"
    supportLibVersion = "25.3.1"
    minSdkVersion = 14
    targetSdkVersion = 25
}

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

模块Gradle文件:

apply plugin: 'com.android.application'

android {

    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "package"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
        debug {
            debuggable true
        }
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

}


repositories {
    jcenter {
        url "http://jcenter.bintray.com/"
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
    compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
    compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
    compile 'com.google.android.gms:play-services-location:11.0.4'

    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.github.beyka:androidtiffbitmapfactory:0.9.6.2'

    debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'

}

enter image description here

1 个答案:

答案 0 :(得分:1)

项目gradle文件:

buildscript {
    repositories {
        jcenter() 
        maven {
         url 'https://maven.google.com'    
       }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

allprojects {
    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    repositories {
        jcenter()
        maven {
          url 'https://maven.google.com'    
       }
  }
}