Issue
I just recently upgraded from Arctic Fox to Dolphin and migrated my project from Gradle 7.0.3 to 7.3.0.
When I want to build project I got error:
Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.4.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.4.0)
Duplicate class androidx.lifecycle.ViewModelProviderKt found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.4.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.4.0)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.4.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.4.0)
My entire project is non-usable and broken right now.
Solution
This happened with me when I added the androidx.preference.preference-ktx:1.2.0
dependency in gradle.
Just add this dependency in build.gradle
file to fix this.
Java ->
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.5.1'
Kotlin ->
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
This error occurs due to one of the dependencies having an explicit dependency of lifecycle 2.3.1
.
Google Tracker Issue Link -> https://issuetracker.google.com/issues/242384116
Hope this helps :)
Answered By - M Ashhal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.