Android Studio 2.3.3:无法解决:com.google.android.gms:play-services-ads:11.8.0,即使使用Maven

问题描述 投票:0回答:1

我正在开发Android Studio上的第一个应用程序,并希望使用Admob为其添加广告。在我的gradle:项目我有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
}

这是我的app级build.gradle依赖项

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'

}

即使我在存储库中有Maven,我仍然会收到错误消息:无法解析:com.google.android.gms:play-services-ads:11.8.0

不应该maven {url“https://maven.google.com”}足以导入移动广告sdk吗?

java android maven android-studio
1个回答
0
投票

你得走了

工具> Android> SDK MANAGER> SDK工具

并检查Google Play服务的最新版本(11.8.0)和确定。最后,在build.gradle中看到它们具有相同的版本。 enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.