Reputation: 21
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?
Upvotes: 0
Views: 1609
Reputation: 16
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
Upvotes: 0