0

So I'm trying to implement admob into my android project. I am following Google's official guide for this purpose (https://developers.google.com/admob/android/quick-start#import_the_mobile_ads_sdk) but I am getting an error on adding this line into my build.gradle(Module app),

implementation 'com.google.android.gms:play-services-ads:17.1.1'

enter image description here issue description :

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:customtabs:26.1.0 less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion). Issue id: GradleCompatible

My Target SDK is API 14

My build.gradle(Module:app) https://justpaste.it/684d6

saonnet
  • 110
  • 7

3 Answers3

0

replace with this.

    apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.bitpix.tales"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    compile 'com.android.support:customtabs:28.0.0'
    compile 'com.android.support:support-v4:28.0.0'
    compile 'com.android.support:support-media-compat:28.0.0'
    compile 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:design:28.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.android.gms:play-services-ads:17.1.2'

}
apply plugin: 'com.google.gms.google-services'
pravin
  • 454
  • 1
  • 6
  • 19
0

Just copy and paste error version shown in gradle. For this scenario it is 'com.android.support:customtabs:26.1.0 '.

Implement this line in your gradle file it will solve the issue.

//add this line
implementation 'com.android.support:customtabs:26.1.0'
//change the version to your appcompat support version it will solve the problem
implementation 'com.android.support:customtabs:28.0.0'

compile gradle once. This error will be resolved.

Mohamed Niyaz
  • 228
  • 1
  • 9
-1

there is number of dependency in support library Bundle, this library have not same version, but you can run without resolved this error. your app run fine.

Mayur Dabhi
  • 3,607
  • 2
  • 14
  • 25