试图在我的应用中添加google adsense广告。等级同步错误:(2,0)带有ID&com; google.android.gms的插件:play-services-ads:8.4.0'找不到。错误即将来临。
构建成绩 - 模块
apply plugin: 'com.android.application'
apply plugin: 'com.google.android.gms:play-services-ads:8.4.0'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.test.tax"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:24.2.1'
testCompile 'junit:junit:4.12'
}
build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
}
构建成绩 - 项目
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:0)
更新Android Studio SDK Manager:单击SDK Tools,展开Support Repository,选择Google Repository,然后单击OK。
试试这个 apply plugin:'com.google.android.gms:play-services-ads:10.2.1'
答案 1 :(得分:0)
我发现了这个问题,在sdk 应用插件的最新更新中:'com.google.android.gms:play-services-ads:8.4.0'不需要。这些都添加在 om.android.application
中删除后,代码得到了遵守。谢谢大家