0

Tried to add google adsense ad in my app. while grade sync up Error:(2, 0) Plugin with id 'com.google.android.gms:play-services-ads:8.4.0' not found. error is coming.

Build Grade - module

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'
}

Build Grade - Project

  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
  }
Pavithran
  • 9
  • 5
  • This seems similar to this [SO thread](http://stackoverflow.com/questions/35124863/could-not-find-com-google-android-gmsplay-services8-4-0). – ReyAnthonyRenacia Apr 15 '17 at 13:04

2 Answers2

0

Update the Android Studio SDK Manager: click SDK Tools, expand Support Repository, select Google Repository, and then click OK.

And try this apply plugin: 'com.google.android.gms:play-services-ads:10.2.1'

Tarun Tak
  • 421
  • 1
  • 5
  • 12
  • done everything. error changed to **Error:(31, 0) Plugin with id 'com.google.android.gms:play-services-ads:10.2.1' not found.** – Pavithran Apr 14 '17 at 19:04
0

I found the issue, In latest updates of sdk apply plugin: 'com.google.android.gms:play-services-ads:8.4.0' is not needed. These are added in om.android.application

After removing it code got complied. Thanks all

Pavithran
  • 9
  • 5