简体   繁体   中英

Android Studio 2.3.3: Failed to resolve: com.google.android.gms:play-services-ads:11.8.0 even with Maven

I'm working on one of my first apps on Android Studio and want to add advertisements to it using Admob. In my gradle: project I have Maven:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

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

allprojects {
repositories {
    jcenter()

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

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

Here is my app-level build.gradle dependencies as well

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:23.4.0'
compile 'com.google.android.gms:play-services-ads:11.8.0'
compile 'com.android.support:design:23.4.0'
testCompile 'junit:junit:4.12'

}

Even though I have Maven in repositories I still get the error message: Failed to resolve: com.google.android.gms:play-services-ads:11.8.0

Shouldn't maven {url " https://maven.google.com "} be enough to import the Mobile Ads sdk?

You have to go

Tools>Android>SDK MANAGER>SDK TOOLS

and check for latest version(11.8.0) of Google Play services and Ok. Finally , in build.gradle see that they have the same version. enter image description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM