My project was working fine until one day, because of no reason (I didn't change anything), gradle started giving this strange error:
Program type already present: com.google.android.gms.internal.measurement.zzabo
At the time of this error my project level gradle was like this:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
maven { url 'https://plugins.gradle.org/m2/'}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.0'
classpath 'io.fabric.tools:gradle:1.25.3'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://dl.bintray.com/sayyam/maven'
}
maven {
url "https://jitpack.io"
}
maven {
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this was my app level gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
defaultConfig {
applicationId "com.example"
deviceCheck
minSdkVersion 17
targetSdkVersion 27
versionCode 8
versionName "1.0"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.firebase:firebase-invites:15.0.1'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
.....other dependencies.....
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
I searched and found this answer on stackoverflow. Which says that this issue might be related to firebase dependency version and google-services plugin. So i updated google-services
plugin version to 4.0.0
and firebase to its latest version 16.0.0
. And as one could expect from gradle, it gave another error which seems to be related to firebase version 16.0.0.
Whenever i change firebase version to 16.0.0, apparently it tries to automatically upgrade google play services dependencies to 16.0.0 too. Which doesn't EVEN exist! It raises following gradle error:
Failed to resolve: com.google.android.gms:play-services-maps:16.0.0
Failed to resolve: com.google.android.gms:play-services-location:16.0.0
Failed to resolve: com.google.android.gms:play-services-places:16.0.0
Failed to resolve: com.google.android.gms:play-services-gcm:16.0.0
Failed to resolve: com.google.android.gms:play-services-base:16.0.0
Failed to resolve: com.google.android.gms:play-services-basement:16.0.0
Failed to resolve: com.google.android.gms:play-services-measurement-base:16.0.0
Failed to resolve: com.google.android.gms:play-services-tasks:16.0.0
Failed to resolve: com.google.android.gms:play-services-stats:16.0.0
Failed to resolve: com.google.android.gms:play-services-ads-identifier:16.0.0
I have tried to force version of gms libraries using resolutionStrategy but to no avail. What should i do? What am I doing wrong?
NOTE: I didn't change play services libraries version explicitly, gradle seems to do it because of firebase.
EDIT: This problem can be solved by the solution given in this question, but still its not duplicate because in my case onesignal plugin was updating only gms libraries version and not firebase version. So anybody facing this problem won't search for keywords used in this question.
I believe you have run into the same issues as the poster of https://stackoverflow.com/a/50516114/7070704 with the same resolution.
Basically, the com.onesignal.androidsdk.onesignal-gradle-plugin plugin is forcing an uplift on your dependencies onto something which does not exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With