【问题标题】:Plugin with id 'com.google.android.gms:play-services-ads:8.4.0' not found未找到 ID 为“com.google.android.gms:play-services-ads:8.4.0”的插件
【发布时间】:2023-03-23 23:05:02
【问题描述】:

尝试在我的应用中添加 google adsense 广告。而成绩同步 Error:(2, 0) Plugin with id 'com.google.android.gms:play-services-ads:8.4.0' not found. 错误即将到来。

构建等级 - 模块

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
  }

【问题讨论】:

标签: android plugins google-play google-play-services


【解决方案1】:

更新 Android Studio SDK Manager:点击 SDK Tools,展开 Support Repository,选择 Google Repository,然后点击 OK。

试试这个 应用插件:'com.google.android.gms:play-services-ads:10.2.1'

【讨论】:

  • 完成了一切。错误更改为 Error:(31, 0) Plugin with id 'com.google.android.gms:play-services-ads:10.2.1' not found.
【解决方案2】:

我发现了问题,在 sdk apply plugin: 'com.google.android.gms:play-services-ads:8.4.0' 的最新更新中不需要。这些是在 om.android.application

中添加的

删除它后,代码得到了遵守。谢谢大家

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-20
    • 2018-01-04
    • 1970-01-01
    • 2017-10-01
    • 1970-01-01
    • 2017-02-14
    • 2019-08-13
    相关资源
    最近更新 更多