Error:Program type already present: android.arch.lifecycle.LiveData

When I press the run button in Android Studio, my app compiles but shows this error (redacted):

Error:Program type already present: android.arch.lifecycle.LiveData

(Full log)

I've tried deleting the .gradle folder, then going to Build > Clean Project and Build > Rebuild Project. However, it doesn't work. I've also tried deleting the source code, then cloning again from git and importing the folder to Android Studio. However, it still produces that error.

Here's my app's app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.edricchan.studybuddy"
        minSdkVersion 24
        targetSdkVersion 27
        versionCode 8
        versionName "1.0.0-rc.503"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        resConfigs "en"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
}

dependencies {
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.android.support:support-annotations:27.1.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    testImplementation 'junit:junit:4.12'
    // Firebase stuff
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.google.firebase:firebase-firestore:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.google.android.gms:play-services-auth:11.8.0'
    implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
    implementation 'com.firebaseui:firebase-ui-firestore:3.1.0'
    implementation 'com.firebaseui:firebase-ui-storage:3.1.0'
    // Provide a way to update the app
    implementation 'com.github.javiersantos:AppUpdater:2.6.4'
    // Chrome Custom Tabs
    implementation 'com.android.support:customtabs:27.1.0'
    // The app's intro screen
    implementation 'com.heinrichreimersoftware:material-intro:1.6.2'
    // Use for new Material Text field boxes recently introduced
    implementation 'com.github.HITGIF:TextFieldBoxes:1.3.7'
    // Report an issue to Github without having to open a new tab and so on...
    implementation 'com.heinrichreimersoftware:android-issue-reporter:1.3.1'
}
apply plugin: 'com.google.gms.google-services'

Apparently, this is intended behavior:

com.firebaseui:firebase-ui-firestore:3.1.0 depends on android.arch.lifecycle:extensions:1.0.0-beta1. Switching to version 3.2.2 fixes the issue by using the Lifecycle 1.1 libraries that Support Library 27.1.0 are built upon. - Issue Tracker

For me, removing the firebase-ui dependencies solved the issue since I wasn't even using the library in the first place.

Android: Program type already present: android.arch.lifecycle , The error occurred when I compile and run the application. Program type already present: android.arch.lifecycle.LiveData$  When I press the run button in Android Studio, my app compiles but shows this error (redacted): Error:Program type already present: android.arch.lifecycle.LiveData


I had the very same problem today when I raised the support library version.

Try to replace all '27.1.0' with '27.0.2'


Later on I did manage to remove the error by upgrading other libraries as well. THis is my current working state: root gradle:

buildscript {
    ext.kotlin_version = '1.2.21'
    ext.support_version = '27.1.0'
    ext.anko_version = '0.10.4'
    ext.android_plugin_version = '3.0.1'
    ext.google_services_version = '11.8.0'

    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"

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

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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

////////////////// app gradle libraries:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }

    // kotlin:
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation "org.jetbrains.anko:anko-common:$anko_version"
    implementation "org.jetbrains.anko:anko-commons:$anko_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.3'

    // support libraries:
    implementation "com.android.support:recyclerview-v7:$support_version"
    implementation "com.android.support:support-v4:$support_version"
    implementation "com.android.support:design:$support_version"
    implementation "com.android.support:appcompat-v7:$support_version"
    implementation "com.android.support:cardview-v7:$support_version"
    implementation "com.android.support:support-vector-drawable:$support_version"

    // misc:
    implementation 'com.github.d-max:spots-dialog:0.7@aar'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta5'
    implementation 'com.backendless:backendless:4.4.0'
    implementation 'io.nlopez.smartlocation:library:3.3.3'

    // Google services:
    implementation "com.google.firebase:firebase-core:$google_services_version"
    implementation "com.google.firebase:firebase-auth:$google_services_version"
    implementation 'com.firebaseui:firebase-ui-auth:3.2.2'

    implementation "com.google.android.gms:play-services-location:$google_services_version"
    implementation "com.google.android.gms:play-services-auth:$google_services_version"

    implementation('com.google.api-client:google-api-client:1.23.0') {
        exclude group: 'com.google.code.findbugs', module: 'jsr305'
    }
}

///////////////

I also upgraded graddle-wrapper.properties to:

#Wed Dec 20 15:08:34 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

Program type already present: android.arch.lifecycle , Program type already present: android.arch.lifecycle.ComputableLiveData # com.mapbox.mapboxsdk:mapbox-android-sdk:6.1.1@aar https://www.mapbox.​com/help/android-navigation-sdk/ when I get the following error. I am getting these errors while compiling my project For resolving the dex archives errors , I tried deleting the .gradle folder from my project directory but still the problem is not resolved. Th


This post is the top search result for the very similar error: "Program type already present: android.arch.lifecycle.ViewModelProvider$Factory"

My project uses Room and LiveData, but not firebase. The following changes removed the error:

FROM:

implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
implementation 'android.arch.lifecycle:extensions:1.0.0'
annotationProcessor 'android.arch.lifecycle:compiler:1.0.0'

TO:

implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'

--- UPDATED ANSWER ---

My previous answer was aimed at solving this error. However, I thought it would be worth presenting it again using best practises:

App level build.gradle file:

// Room components
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"

// Lifecycle components
implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"

Project level build.gradle file:

ext {
   roomVersion = '1.1.1'
   archLifecycleVersion = '1.1.1'
}

Reference: https://codelabs.developers.google.com/codelabs/android-room-with-a-view/#2

Android: Error:Program type already present: android.arch.lifecycle , com.firebaseui:firebase-ui-firestore:3.1.0 depends on android.arch.lifecycle:​extensions:1.0.0-beta1. Switching to version 3.2.2 fixes the issue by  Home » Java » “Program type already present: Android.arch.lifecycle.LiveData$1 “Program type already present: Android.arch.lifecycle.LiveData$1 Posted by: admin April 30, 2018 Leave a comment


Program type already present: android.arch.lifecycle.LiveData$1 in , com.firebaseui:firebase-ui-firestore:3.1.0 depends on android.arch.lifecycle:​extensions:1.0.0-beta1. Switching to version 3.2.2 fixes the issue by  Thanks for reaching out @diarmuidcire.My guess would be that you are trying to use Support Library v27.1.1 which is not compatible with lifecycle components v1.1.1 that are used in the LocationLayerPlugin, see this issue.


I also had the error posted in the original question, namely:

Error:Program type already present: android.arch.lifecycle.LiveData

It wasn't clear which libraries were causing the problem. With a hint from @lienmt above I realized that it may be related Firebase.

In my case, I am using Firebase and was also using firebase-ui library 3.2.2:

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

I had upgraded all my other Firebase libraries to 15.0.0 but realized my firebase-ui library was incompatible and confirmed it here:

https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries

Be sure to match your firebase-ui version to the exact Firebase versions that for which they are fixed for pairing.

Bumping my firebase-ui version to 3.3.1 was what resolved the error:

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

For reference here are the versions I'm using now and my app is running with no errors:

implementation 'com.google.android.gms:play-services-wearable:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
implementation 'com.firebaseui:firebase-ui-database:3.3.1'

Hi I was reading your guide and was wondering if you could offer a , When I press the play button in Android Studio, my app compiles but is shows this error Program type already present: android.arch.lifecycle.LiveData$1 I've  Build fails with 'Program type already present: android.arch.core.util.Function' #1357 jcmbmercadoni opened this issue Jun 14, 2018 · 19 comments Comments


Gradle build fails as GameAnalytics conflicts with a library using , Error:Program type already present: android.arch.lifecycle.LiveData. (Full log). I'​ve tried deleting the .gradle folder, then going to Build > Clean  Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.


Error: Program type already present: android.arch.lifecycle.ViewModelStore. My gradle dependencies are as follows, and I am not sure I'm  I was happily developing against 15.0.0 and suddenly a cryptic "Program type already present: com.google.android.gms.internal.measurement.zzwq" interrupts my flow - NOT COOL! 👍 1 😕 4


I have a custom .jar library in my project that uses Android Room database. Now when I "assembleDebug"; stderr[; D8: Program type already present: android.​arch.core.executor.ArchTaskExecutor$1; FAILURE: Build failed with an exception​. +--- :android.arch.lifecycle.livedata-core-1.1.0:@aar; +---  The following are top voted examples for showing how to use android.arch.lifecycle.LiveData.These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.