26

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'
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96

12 Answers12

24

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.

Rajar
  • 274
  • 1
  • 7
  • 2
    You're right. There is a problem between "com.google.firebase:firebase-core:15.0.0-15.0.1" and classpath 'com.google.gms:google-services:3.2.0'. I just updated google-services to 3.2.1 and firebase to 15.0.2 and I can compile project now. Thanks! Note: I am not using Kotlin, so problem should be related with firebase-GooglePlayServices. – Aykut Uludağ May 03 '18 at 13:48
  • Thanks for the feedback about the Kotlin related or not question! – Rajar May 04 '18 at 14:54
  • Hello freinds, i am getting same error and i am using classpath 'com.google.gms:google-services:4.0.1', can anyone help me about this, i just update lettest firebase library like firebase database 17.0.4 to 17.1.2, please help me for this, thank you – Qutbuddin Bohra Nov 08 '18 at 13:40
  • Have you tried with the 4.1.0 or 4.2.0 version of the Google Services Gradle Plugin ? (see https://stackoverflow.com/a/53156783/8203894) – Rajar Nov 13 '18 at 16:35
7
  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

Md. Sabbir Ahmed
  • 850
  • 8
  • 22
  • 1
    Updating messaging was not sufficient for me. I ended up updating all my firebase implementations to the newest version. Notice that they have changed them to have independent [version numbers](https://firebase.google.com/support/release-notes/android) now. – DanD May 03 '18 at 17:05
5
 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'
Ben.Slama.Jihed
  • 534
  • 6
  • 14
5

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

Arun Antoney
  • 4,292
  • 2
  • 20
  • 26
  • This helped me resolve a Xamarin Forms issue relating to Firebase Cloud Messaging. Thank you! – foamy Mar 23 '20 at 06:26
4

I started seeing this after I upgraded to kotlin plugin version : 1.2.41-release-Studio3.1-1.

Upgrading firebase-core and firebase-messaging from 15.0.0 --> 15.0.2. Fixed the problem, database, auth and gms-auth-services are at 15.0.0

Himanshu Walia
  • 163
  • 1
  • 9
  • when I'm trying to set firebase-core and firebase-messaging from 15.0.0 --> 15.0.2. and setting rest of the services like the database, auth, and gms-auth-services at 15.0.0 gives me below error. `Please fix the version conflict either by updating the version of the google-services plugin` – Pankaj Lilan May 03 '18 at 07:57
4

I fixed the issue using new firebase independent version numbers https://firebase.google.com/support/release-notes/android#latest_sdk_versions

SDK Update - May 2, 2018 -> Firebase Android SDKs now have independent version numbers, allowing for more frequent, flexible updates.

enter image description here

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
Josue Amador
  • 156
  • 2
  • 4
2

I had the same error and I fixed it updating lines below:

build.grade (Project: [project_name])

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

build.grade (Module: app)

implementation 'com.firebaseui:firebase-ui-auth:3.3.1'

I hope it helps.

Bruno Neuman
  • 128
  • 1
  • 10
1

I had the same exact error. I was using

    implementation 'com.firebaseui:firebase-ui-auth:3.2.2'

I solved it updating to

    implementation 'com.firebaseui:firebase-ui-auth:3.3.0'

Another possible cause/fix might be the build.gradle at project level

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'
    classpath 'com.google.gms:google-services:3.2.0'

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

}

Sila Siebert
  • 422
  • 4
  • 10
  • did u find any solution for this – Nabeel K Apr 20 '18 at 09:30
  • 1
    Dears please share if find any solution! I've tried many times and combinations: gradle plugin, gradle 4.4, 4.5, enable D8 multdex, disable... when I want debug... show: Program type already present: com.google.android.gms.internal.measurement.zzabn – Mateus May 03 '18 at 02:01
1

This is very boring. Google should review these updates better. I tried everything, but my issue was only fixed by returning the version of the Google Play Services APIs:

implementation 'com.google.android.gms:play-services-gcm:11.8.0'

  • I had this problem from nothing!! Why? Any idea? – Douglas Fornaro May 03 '18 at 01:47
  • Paulo, this is a very boring! In my project, i use firebase storage, auth, database. I don't "downgrade" to mount my project. Impossible. I've tried many types of configuration, include enable/disable D8 multdex..., update firebase APIs to newer 15.0.1 ... don't solve. A week ago, my project was perfect! Today crashed and I don't change anything! Really stop build! Incredible!!! – Mateus May 03 '18 at 01:55
  • 2
    @Mateus Our team solved it by upgrading to the latest version of all Firebase & Play Services APIs (15.0.2) – Adam Haafiz May 03 '18 at 02:21
1

Screenshot from firebase latest release notes Go to the folllowing link : https://firebase.google.com/support/release-notes/android and check for the latest firebase dependencies with the current compatible google play service version as shown in the screenshot below.

Mayur Waghmare
  • 61
  • 1
  • 1
  • 4
  • I updated classpath 'com.google.gms:google-services:4.1.0' to classpath 'com.google.gms:google-services:4.2.0'. And this solved my problem. – Ahamadullah Saikat Nov 07 '18 at 17:19
0

For me the problem was

dependencies {
       classpath 'com.google.firebase:firebase-plugins:1.1.5'
}

used for Performance Monitoring. Just commented out.

tsig
  • 148
  • 2
  • 6
0

I had the same issue, the thing which is causing this error is 2 versions of same dependency with different services

I changed this:

implementation 'com.google.android.gms:play-services-ads:17.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.5'

To:

implementation 'com.google.android.gms:play-services-ads:17.1.1'

these versions are importing same subpackages which is why it is a ambiguity error basically same subpackage is imported from 2 different dependencies (in background)

Have fun coding!!