Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate class androidx.lifecycle.ViewModel in coil 2.2.0 #1423

Closed
lUjek-Sh opened this issue Sep 1, 2022 · 7 comments
Closed

Duplicate class androidx.lifecycle.ViewModel in coil 2.2.0 #1423

lUjek-Sh opened this issue Sep 1, 2022 · 7 comments

Comments

@lUjek-Sh
Copy link

lUjek-Sh commented Sep 1, 2022

Describe the bug
After update coil to 2.2.0, i have error "Duplicate class androidx.lifecycle.ViewModel". But if i use coil 2.1.0 all is well.

To Reproduce
Update to coil version 2.2.0

Logs/Screenshots

Duplicate class androidx.lifecycle.ViewModelLazy found in modules lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0) and lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0) and lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1)

Version
Kotlin 1.7.10
compileSdkVersion 32

My Dependencies

dependencies {
    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.exifinterface:exifinterface:1.3.3'
    implementation 'org.jetbrains:annotations:23.0.0'

    implementation "androidx.recyclerview:recyclerview:1.2.1"
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.google.android.material:material:1.6.1'
    implementation "androidx.constraintlayout:constraintlayout:2.1.4"
    implementation 'com.github.faruktoptas:FancyShowCaseView:1.3.9'
    implementation "me.zhanghai.android.materialratingbar:library:1.4.0"

    implementation "com.google.firebase:firebase-analytics-ktx:21.1.0"
    implementation "com.google.firebase:firebase-crashlytics-ktx:18.2.12"
    implementation "com.google.firebase:firebase-messaging:23.0.7"

    implementation(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")

    implementation "androidx.room:room-runtime:2.5.0-alpha02"
    implementation "androidx.room:room-ktx:2.5.0-alpha02"
    kapt("androidx.room:room-compiler:2.5.0-alpha02")

    implementation "io.coil-kt:coil:2.2.0"
    implementation "io.coil-kt:coil-gif:2.2.0"

    implementation "com.louiscad.splitties:splitties-alertdialog-appcompat:3.0.0"
    implementation 'io.insert-koin:koin-android:3.2.0'
    implementation "com.github.terrakok:cicerone:7.1"
    implementation 'com.google.code.gson:gson:2.9.1'
    implementation 'com.jakewharton.timber:timber:5.0.1'
    implementation "com.github.yandextaxitech:binaryprefs:1.0.0"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
    implementation 'androidx.work:work-runtime-ktx:2.7.1'
    implementation 'com.cloudipsp:android:1.17.1'
    implementation 'com.luckycatlabs:SunriseSunsetCalculator:1.2'

    implementation 'com.google.android.play:core-ktx:1.8.1'

    implementation "com.google.android.gms:play-services-maps:18.1.0"
    implementation 'com.google.android.gms:play-services-auth:20.2.0'
    implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
}
@colinrtwhite
Copy link
Member

colinrtwhite commented Sep 7, 2022

Unfortunately, this is an androidx bug. The ticket says it will be fixed in appcompat-resources:1.5.1, which should hopefully be released tomorrow. Once it's released I'll cut a 2.2.1 release with the fix.

@colinrtwhite
Copy link
Member

Fixed by 3a43cb0. You can also upgrade to appcompat:1.5.1 locally to immediately fix this issue.

@colinrtwhite
Copy link
Member

Actually it doesn't seem like appcompat-resources:1.5.1 fixed this issue (at least in my tests). I've downgraded to appcompat-resources:1.4.2 in Coil 2.2.1 as there aren't any necessary fixes in appcompat-resources:1.5.1 for Coil.

Once this issue is solved in a stable release it should be ok to bump Coil's androidx dependencies again.

@yangdengxueshi
Copy link

yangdengxueshi commented Jul 17, 2023

`

dependencies {

configurations {

    all {

        exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'

    }

}

}

`

No thanks

@RohanAppinventiv
Copy link

`

dependencies {

configurations {

    all {

        exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'

    }

}

}

`

No thanks

where to put it ?
I am not able to see any configuration {} in my gradles

@iamromec
Copy link

I'm facing the same issue. And it's not resolved after following the above steps as well. PFA

Please help.

Screenshot 2024-05-12 at 9 44 27 PM

@iamromec
Copy link

I'm also facing this issue for the last few days. Please help/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants