0

I have an error message in Android Studio when I tried to generate a new signed apk. The error is : "


Program type already present: com.google.android.gms.common.api.internal.zzd Message{kind=ERROR, text=Program type already present: com.google.android.gms.common.api.internal.zzd, sources=[Unknown source file], tool name=Optional.of(D8)}


Here is my gradle file :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "fr.xyz.application"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 46
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [
                onesignal_app_id: 'c52d60a9-812a-42d2-9157-7d2e5d777803',
                onesignal_google_project_number: 'REMOTE'
        ]
    }
    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.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.android.support:design:26.1.0'

    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    implementation 'io.reactivex:rxjava:1.2.1'
    implementation 'io.reactivex:rxandroid:1.2.1'

    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'

    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'


    implementation 'com.google.firebase:firebase-auth:16.0.2'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

and my build.gradle(project)

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

buildscript {

    repositories {
        google()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.0.2'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.1, 0.99.99]'


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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.google.com' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Jats1596
  • 1,117
  • 1
  • 13
  • 20
  • 1
    update your dependencies – kam1234 Oct 31 '19 at 15:49
  • https://stackoverflow.com/a/50147103/5192105 – Sachin Bahukhandi Oct 31 '19 at 15:50
  • @kam1234 is right. Simply update all your dependencies and make sure they correspond with the gradle version you are using. – Taslim Oseni Oct 31 '19 at 15:51
  • how can I update all my dependencies ? Do I have to do it manually ? – Jats1596 Oct 31 '19 at 15:53
  • Does this answer your question? [Android Studio- Program type already present: com.google.android.gms.internal.measurement.zzwp](https://stackoverflow.com/questions/50146640/android-studio-program-type-already-present-com-google-android-gms-internal-me) – Gerard Oct 31 '19 at 16:12
  • I just updated the dependencies manually but then I got : " error: resource android:attr/fontVariationSettings not found" and "error: resource android:attr/ttcIndex not found" and at the bottom I got "failed linking references" – Jats1596 Oct 31 '19 at 16:18

1 Answers1

0

Use these dependencies :

    implementation 'com.google.firebase:firebase-messaging:17.0.0'{
    exclude group: 'com.google.android.gms'
}
    implementation 'com.google.firebase:firebase-core:16.0.1'{
    exclude group: 'com.google.android.gms'
}
    implementation 'com.google.firebase:firebase-auth:16.0.2'{
    exclude group: 'com.google.android.gms'
}
implementation('com.facebook.android:facebook-android-sdk:4.x') {
    exclude group: 'com.google.android.gms'
}
Karan Khurana
  • 575
  • 8
  • 20