使用com.google.android.gms时会出现错误:play-services映射:我的应用程序中的11.2.



我正在尝试创建一个简单的Android应用程序。我有最新版本的Android Studio,我认为我的Gradle Build Files都是正确的。

我放置了

implementation 'com.google.android.gms:play-services-maps:11.2.0'

在App Gradle依赖项中。

因此,我收到以下错误:

无法解决':app@debug/compileclasspath':无法解决com.google.android.gms:play-services-maps:11.2.0。

我已经查看了各种链接,并尝试了提出的解决方案,但没有一个对我有用。

以下是我的gradle构建文件。

项目build.gradle:

//Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    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 {
    google()
    jcenter()
    maven { url "https://repo.situm.es/artifactory/libs-release-local" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

应用程序build.gradle:

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
    applicationId "demo.situm.situmapp"
    minSdkVersion 21
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    //testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
        matchingFallbacks = ['release', 'debug']
    }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-maps:11.2.0'
//testImplementation 'junit:junit:4.12'
//androidTestImplementation 'com.android.support.test:runner:1.0.1'
//androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
}
//apply plugin: 'com.google.gms.google-services'

希望您能提供帮助。

谢谢Kabir

尝试一下:

无法解决com.google.android.gms play-services-auth:11.2.0

将maven添加到您的根级build.gradle文件

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

11.2.0。

或将Google()存储库添加到您的" build.gradle" 文件。这种gradle方法相当于

maven {url" https://maven.google.com"}。

repositories {
    jcenter()
    google()
}

相关内容

最新更新