2
 Program type already present: android.arch.lifecycle.LiveData$1
 Message{kind=ERROR, text=Program type already present: 
 android.arch.lifecycle.LiveData$1, sources=[Unknown source file], tool 
 name=Optional.of(D8)}

Im currently studying android architecture, but when I tried to add the extension library android.arch.lifecycle:extensions:1.0.0 Im having the error above,

I tried to exclude the lifecycle common module in gradle

implementation('android.arch.lifecycle:extensions:1.0.0') {
    exclude group: 'android.arch.lifecycle', module: 'lifecycle'
}

but still having the error above, below is the dependency report from gradlew

+--- com.android.support:appcompat-v7:27.1.1
|    +--- com.android.support:support-annotations:27.1.1
|    +--- com.android.support:support-core-utils:27.1.1
|    |    +--- com.android.support:support-annotations:27.1.1
|    |    \--- com.android.support:support-compat:27.1.1
|    |         +--- com.android.support:support-annotations:27.1.1
|    |         \--- android.arch.lifecycle:runtime:1.1.0
|    |              +--- android.arch.lifecycle:common:1.1.0
|    |              |    \--- com.android.support:support- 
annotations:26.1.0 -> 27.1.1
|    |              +--- android.arch.core:common:1.1.0
|    |              |    \--- com.android.support:support- 
annotations:26.1.0 -> 27.1.1
|    |              \--- com.android.support:support- 
annotations:26.1.0 -> 27.1.1
|    +--- com.android.support:support-fragment:27.1.1
|    |    +--- com.android.support:support-compat:27.1.1 (*)
|    |    +--- com.android.support:support-core-ui:27.1.1
|    |    |    +--- com.android.support:support-annotations:27.1.1
|    |    |    +--- com.android.support:support-compat:27.1.1 (*)
|    |    |    \--- com.android.support:support-core-utils:27.1.1 (*)
|    |    +--- com.android.support:support-core-utils:27.1.1 (*)
|    |    +--- com.android.support:support-annotations:27.1.1
|    |    +--- android.arch.lifecycle:livedata-core:1.1.0
|    |    |    +--- android.arch.lifecycle:common:1.1.0 (*)
|    |    |    +--- android.arch.core:common:1.1.0 (*)
|    |    |    \--- android.arch.core:runtime:1.1.0
|    |    |         +--- com.android.support:support- 
annotations:26.1.0 -> 27.1.1
|    |    |         \--- android.arch.core:common:1.1.0 (*)
|    |    \--- android.arch.lifecycle:viewmodel:1.1.0
|    +--- com.android.support:support-vector-drawable:27.1.1
|    |    +--- com.android.support:support-annotations:27.1.1
|    |    \--- com.android.support:support-compat:27.1.1 (*)
|    \--- com.android.support:animated-vector-drawable:27.1.1
|         +--- com.android.support:support-vector-drawable:27.1.1 (*)
|         \--- com.android.support:support-core-ui:27.1.1 (*)
+--- com.android.support.constraint:constraint-layout:1.1.0
|    \--- com.android.support.constraint:constraint-layout- 
 solver:1.1.0
+--- android.arch.lifecycle:extensions:1.0.0
|    +--- android.arch.lifecycle:runtime:1.0.3 -> 1.1.0 (*)
|    +--- android.arch.core:common:1.0.0 -> 1.1.0 (*)
|    +--- android.arch.core:runtime:1.0.0 -> 1.1.0 (*)
|    +--- com.android.support:support-fragment:26.1.0 -> 27.1.1 (*)
|    \--- android.arch.lifecycle:common:1.0.3 -> 1.1.0 (*)
+--- io.reactivex.rxjava2:rxjava:2.1.12
|    \--- org.reactivestreams:reactive-streams:1.0.2
\--- junit:junit:4.12
 \--- org.hamcrest:hamcrest-core:1.3

I'm just assuming that its a transitive dependency and I just need to exclude the LiveData's module out of the extension.

Marc Ebra
  • 43
  • 4
  • Try adding this way: implementation "android.arch.lifecycle:extensions:1.1.1" annotationProcessor "android.arch.lifecycle:compiler:1.1.1" – hetsgandhi Aug 20 '18 at 05:58

0 Answers0