Besart
Besart

Reputation: 399

I cannot upgrade Compose from 1.1.1 to 1.2.0

Hello I am working on a new app with Compose 1.1.1 and I want to upgrade it to version 1.2.0. I am using org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0 which seems to be the problem. This is the error:

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

And this one aswell:

Caused by: org.gradle.api.GradleException: Cannot find a version of 'org.jetbrains.kotlinx:kotlinx-coroutines-core' that satisfies the version constraints:

enter image description here

enter image description here

These are the dependencies I am using:

dependencies {

//Hilt dependency injection
implementation("com.google.dagger:hilt-android:$hilt_version")
kapt("com.google.dagger:hilt-android-compiler:$hilt_version")
implementation "androidx.hilt:hilt-navigation-compose:1.0.0"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"

//Realm Mongo implementation
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt'
implementation 'io.realm.kotlin:library-sync:1.0.1'
implementation("io.coil-kt:coil-compose:1.4.0")

implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}

Upvotes: 2

Views: 862

Answers (1)

PineapplePie
PineapplePie

Reputation: 953

It's because of the dependencies conflict. Compose 1.2.0 wants to get coroutines 1.6.1 while your Realm dependency has 1.6.0-native-mt which is lower AND it seems like they put a strict array of versions which could be used - aka deprecated force = true (cannot find anything probably bc Realm is not an open-source project, but Gradle is giving a hint). I checked a changelog and according to this Realm is not compatible with the higher version and it's not planned yet.

In your case you can also force the downloaded dependency

 implementation ('org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt') {
    version {
        strictly '1.6.0-native-mt'
    }
}

And your project most likely will be built successfully. But I'll be honest - I don't have any idea how it will impact on Compose, I would assume that it's none, but who knows? So it looks like a trade-off :)

Upvotes: 2

Related Questions