javabuild.gradleandroid-studio-3.1.3

Program type already present: com.google.android.gms.common.api.zzd , not able to resolve


I just upgraded android studio to 3.1.3 and created new project showing admob banner ad, but I got this error.

I opened my older project in this newer version[3.1.3], I had lots of errors but I solved them by searching online. For this error I couldn't find anything.

following are dependencies from build.gradle file

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
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:12.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'

}

Thank you.


Solution

  • Solved. It was problem in build.gradle, I made small change in dependencies

    implementation "com.google.android.gms:play-services-gcm:15.0.1"
    

    refering to this answer

    if you encounter this type of problem then check your dependencies and their versions.