Firebase core dependency : Program type already present: android.support.v4.app.INotificationSideChannel

Viewed 1101

After including Firebase core dependency in my project

implementation 'com.google.firebase:firebase-core:15.0.2'

I am getting this error.

Program type already present: android.support.v4.app.INotificationSideChannel Message{kind=ERROR, text=Program type already present: android.support.v4.app.INotificationSideChannel, sources=[Unknown source file], tool name=Optional.of(D8)}

I went through a few similar questions but none of them seem to solve my error.

Here is my app level build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.2"
    defaultConfig {
        applicationId "com.example.chandranichatterjee.appname"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
    //implementation 'com.google.firebase:firebase-core:11.2.0'
    implementation 'com.google.firebase:firebase-core:15.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
}
apply plugin: 'com.google.gms.google-services'

Below is my project level build.gradle:

buildscript {

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


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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I have also included below lines in gradle.properties:

android.useAndroidX=true
android.enableJetifier=true

Any help is appreciated. Thanks!

1 Answers

1.

classpath 'com.android.tools.build:gradle:3.1.0'

==>

classpath 'com.android.tools.build:gradle:3.2.0'

https://developer.android.com/studio/releases/gradle-plugin

Plugin version, Required Gradle version
3.2.0 - 3.2.1 , 4.6+ 
3.3.0 - 3.3.2 , 4.10.1+
3.4.0+        , 5.1.1+
  1. add gradle.properties
android.useAndroidX=true
android.enableJetifier=true
Related