AndroidStudio - Program type already present: com.google.android.gms.location.places.zza

First : Let me explain the situation , i have an sdk works with google Api and implementing a lot of dependencies. then i implement the lib into my new app which is also implements dependencies. everything goes fine until i try to run the app. When i run (on device) my project I get the following error message:

Error: Program type already present: com.google.android.gms.location.places.zza

With the following stacktrace in the Gradle Log (not all of it)

Program type already present: com.google.android.gms.location.places.zza
Learn how to resolve the issue at https://developer.android.com/studio/buil/dependencies#duplicate_classes. at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)

Here is build.gradle Project (lib)

buildscript {
repositories {
    google()
    jcenter()

}
dependencies {
    //**------------Added Recently----------------**//
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.1.0'


    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files}
}
plugins {
id "com.jfrog.bintray" version "1.7.3"
}
allprojects {
repositories {
    google()
    jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

And this is build.gradle Module:app(lib)

apply plugin: 'com.android.library'
archivesBaseName = "inngage-lib"
ext {
PUBLISH_GROUP_ID = 'br.com.inngage.sdk'
PUBLISH_ARTIFACT_ID = 'inngage-lib'
PUBLISH_VERSION = '2.2.0'
}

android {
lintOptions {
    abortOnError false
}
signingConfigs {
    w
    release {
        keyAlias 'inngage-lib'
        keyPassword '************************************'
        storeFile file('/Users/Downloads/inngage-lib.keystore')
        storePassword '***********************************'
    }
}
compileSdkVersion 28
useLibrary 'org.apache.http.legacy'
defaultConfig {
    minSdkVersion 14
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
    debug {
        minifyEnabled false
    }
}
}

dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
 //noinspection UseOfBundledGooglePlayServices
 //implementation 'com.google.android.gms:play-services:12.0.1'
// implementation "com.google.android.gms:play-services-base:16.0.1"
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'

implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-iid:16.0.0'

testImplementation 'junit:junit:4.12'
}
      apply plugin: 'com.google.gms.google-services'
      apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'

       apply plugin: 'com.jfrog.bintray'

Here is build.gradle Project(** my App**)

buildscript {

    repositories {
        maven { url "https://dl.bintray.com/inngage/repo" }
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url "https://dl.bintray.com/inngage/repo" }
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And this is build.gradle Module:app(** my App**)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.admin.sdk_test"
        minSdkVersion 23
        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(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    /* added */
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    /* Inngage SDK*/
    implementation 'br.com.inngage.sdk:inngage-lib:2.2.0'
    /*---------------*/
    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'
}
apply plugin: 'com.google.gms.google-services'

already present is never being caused by a missing dependency ...

implementation ("br.com.inngage.sdk:inngage-lib:2.2.0") {
    exclude group: "com.google.android.gms", module: "play-services"
}

just see MavenCentral, it adds a few duplicate & outdated dependencies.

Program type already present: com.google.android.gms.internal.zzcce classpath 'com.google.gms:google-services:3.2.0' // NOTE: Do not place your application @hiddeneyes02 what version of Android Studio are you using? implementation 'com.google.android.gms:play-services-location:15.0.0' Update your firebase dependencies. 1. Project level build.gradle. Update google.gms version to latest.Track latest release.At time of answer latest is 4.1.0.. buildscript { //

I Added this dependency and it worked fine !

implementation 'com.google.android.gms:play-services-places:16.0.0'

And I got the following error: AGPBI: {"kind":"error","text":"Program type already present: Remove all com.google.android.gms.location.places and replace with:​. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more AndroidStudio - Program type already present: com.google.android.gms.location.places.zza

the problem is that you have a duplicated dependency with different version if you can find the implementation that needs com.google.android.gms.location you can put under it exclude com.google.android.gms or simply in build.gradle module:project

 ext {
  googlePlayServicesVersion = "16.0.0"
}

Error: Program type already present: I read the document at "https://developer.​android.com/studio/build/dependencies#duplicate_classes"  Android Studio Build Failed: Program type already present: com.google.android.gms.location.places.zza #181 Closed LanceMagnaye26 opened this issue Nov 6, 2018 · 4 comments

D8: Program type already present: com.facebook.unity. how to resolve the issue at https://developer.android.com/studio/build/dependencies#​duplicate_classes. in inconsistent location 'C:\Users\juil\AppData\Local\​Android\Sdk_tools' (Expected Warning: activity#com.google.firebase.auth.​internal. Program type already exists: com.google.android.gms.common.api.zzf firebase-core warning -> All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes).

In this video we will solve error: program type already present: Internet Download Manager Duration: 6:45 Posted: Jan 10, 2019 I am facing the below : Program type already present: com.google.android.gms.internal.measurement.zzc. Please help My top level graddle // Top-level build file where you can add configuration options common to all sub-projects/modules.

Starting from version 18.0.0 dependency com.google.android.gms:play-services-​ads uses AndroidX packages instead of Support Library. I was happily developing against 15.0.0 and suddenly a cryptic "Program type already present: com.google.android.gms.internal.measurement.zzwq" interrupts my flow - NOT COOL! 👍 1 😕 4

Comments
  • Thank you Very much
  • @RAHUL that was in my case , maybe in your case you are using google-play-services ('com.google.android.gms:play-services:12.0.1') ? because if yes , that will add duplicated dependencies that will cause the problem.
  • @RAHUL thats great ;)
  • Thank you for your help but it was a missibg Dependency implementation 'com.google.android.gms:play-services-places:16.0.0'