-1

I am trying to integrate Firebase messaging service into my app. But Gradle giving following error after compilation.

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

Project build.gradle file dependencies

`{
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }`

App build.gradle file dependencies :

`{
        implementation ...        
        implementation 'com.google.firebase:firebase-core:15.0.2'
        implementation 'com.google.firebase:firebase-messaging:15.0.2'
    }`

I followed suggestion in following thread. But didnt work out.

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

And firebase offers to use 16.0.0 version for core , 17.1.0 for messaging. But also that combination doesnt work. Any help appreciated.

https://firebase.google.com/docs/cloud-messaging/android/client

luckystones
  • 301
  • 4
  • 14

2 Answers2

0

did you implement this after the dependencies in your app gradle ?

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

I fixed the error by removing following dependency.

implementation 'com.google.android.gms:play-services:8.3.0'

Because also firebase.core includes higher version of this library. That makes a conflict. Thats why gradle giving error as already present

luckystones
  • 301
  • 4
  • 14