Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program type already present: com.google.android.gms.internal.zzfq

I getting this error. Despite trying all thing I am unable to resolve it. Please help me.

Things that I tried are:

  1. Delete .build, .idea etc then rebuild
  2. Clean and rebuild
  3. Change version of compile library

Thank you

plugins

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'

Android

android {
dexOptions {
    preDexLibraries = false
    javaMaxHeapSize "2g"
}

compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId "com.funzone.alarmnap"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    multiDexEnabled true
    versionName "1.1"
    vectorDrawables.useSupportLibrary = true
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
   }

Greendao Plugin

 apply plugin: 'org.greenrobot.greendao'
 greendao {
   targetGenDir 'src/main/java'
   schemaVersion 2
 }

All libraries:

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.jjoe64:graphview:4.2.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.facebook.android:audience-network-sdk:4.+'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.facebook.android:notifications:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'org.greenrobot:greendao:3.2.2'
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:shadows-multidex:3.0"
testImplementation 'org.robolectric:robolectric:3.4.2'
implementation 'com.android.support:preference-v7:27.1.0'
}




repositories {
mavenCentral()
google()
}

Google plugin

apply plugin: 'com.google.gms.google-services'
like image 318
Vaibhav Kumar Gautam Avatar asked Apr 01 '18 15:04

Vaibhav Kumar Gautam


4 Answers

I fix the same issue in my project - after updating the Kotlin plugin to 1.2.41 (I don't know if it is really related. Edit: apparently this is not related with Kotlin) - with :

classpath 'com.google.gms:google-services:3.2.1' 

https://developers.google.com/android/guides/google-services-plugin

Remark: I could stay with the unique 15.0.0 Google Play Services libraries version but not the play-services-tagmanager one and firebase :

implementation "com.google.android.gms:play-services-tagmanager:15.0.2"
implementation "com.google.firebase:firebase-core:15.0.2"

The project is compiling now.

like image 102
Rajar Avatar answered Oct 18 '22 08:10

Rajar


  1. set implementation 'com.google.firebase:firebase-messaging:15.0.2' at the app level build.gradle file, if you are using firebase
  2. set classpath 'com.google.gms:google-services:3.2.0' at the project level build.gradle file

Then sync the build.gradle files

like image 34
Tonny Anthony Avatar answered Oct 18 '22 07:10

Tonny Anthony


 classpath 'com.google.gms:google-services:3.2.0' 

and

//Firebase
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.1'
like image 5
Ben.Slama.Jihed Avatar answered Oct 18 '22 06:10

Ben.Slama.Jihed


You will need to update the version of the individual libraries. This addresses the issue where version 3.3.0 of the Google Services Gradle plugin reports: The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.0,15.0.0], [15.0.2,15.0.2]], but resolves to 15.0.2...

enter image description here

For more info regarding the latest update check release updates from below link Firebase May 2nd release notes

like image 5
Arun Antoney Avatar answered Oct 18 '22 08:10

Arun Antoney