1

I am having trouble with this problem:

Error: Program type already present: com.google.android.gms.internal.measurement.zzfs

It was working fine on november 9 and I released a new version, but now I am getting this error. I dont know which library causes this problem here is my gradles..

The app module gradle:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId ""
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 40
        versionName "1.2.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJsUnitRunner"
    }
    allprojects {
        repositories {
            jcenter()
            google()
        }
    }
    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:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.google.android:flexbox:1.0.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.okhttp3:okhttp:3.4.1'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.facebook.android:facebook-login:[4,5)'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
    implementation 'com.google.android.gms:play-services-wallet:16.0.1'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'io.card:android-sdk:5.5.1'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
    implementation 'com.facebook.android:audience-network-sdk:5.1.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'

    implementation 'com.android.support:gridlayout-v7:26.1.0'
    implementation 'com.smartyads:ad-container:0.4.6'
}

apply plugin: 'com.google.gms.google-services'

This is Project base gradle :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.25.4'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://dl.bintray.com/smartyads/maven/" }
        maven {
            url 'https://maven.google.com/'
        }
    }
}

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

As you can see I am using the latest sdk versions of gms groups, firebase and facebook audience network. However, still I get the problem.

Possible duplicate of this this and this, but I can not resolve this problem from these threads.

Amit Jangid
  • 2,741
  • 1
  • 22
  • 28
Tim Black
  • 39
  • 5
  • If you did not changed your gradle file since 9th of Nov. than it sounds strange. It seems that 2 or more libs are using the same dependency to com.google.android.gms.internal.***. Anyway you can try several things: 1) Invalidate cache and restart. 2) Clean the gradle cache folder under ~/.gradle and reimport the project 3) Run gradle :app:dependencies command and check which dependencies uses the same sub dependency, and apply exclude for one of them. Maybe you have some .jar in your libs folder what may cause this issue? – Mondok Tamas Nov 16 '18 at 10:59
  • Thanks for your comment. I did not, and it is really strange. I have fixed the issue with excluding that library from every library and keeping only in firebase core – Tim Black Nov 16 '18 at 12:32
  • You're welcome. I guess my answer was helpful :) – Mondok Tamas Nov 16 '18 at 12:38

0 Answers0