28

I'm getting the following error running observeAsState on a LiveData object after I upgraded Jetpack Compose to 1.0.0‑beta07.

java.lang.NoSuchMethodError: No interface method startReplaceableGroup(ILjava/lang/String;)V in class Landroidx/compose/runtime/Composer; or its super classes

The documentation says that the error is expected upon upgrade and in order to resolve it one must recompile libraries dependent on Compose.

I do not know have to do that. I tried making the project again and also clearing and rebuilding it with no avail.

Here are the dependencies in my project:

dependencies {
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.ui:ui-tooling:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha01'
    implementation 'androidx.activity:activity-compose:1.3.0-alpha07'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
    implementation "io.github.vanpra.compose-material-dialogs:datetime:0.4.0"
    implementation "io.github.vanpra.compose-material-dialogs:datetime:0.4.0"
    implementation "androidx.appcompat:appcompat:$appCompatVersion"
    implementation "androidx.activity:activity-ktx:$activityVersion"
    implementation "androidx.room:room-ktx:$roomVersion"
    kapt "androidx.room:room-compiler:$roomVersion"
    androidTestImplementation "androidx.room:room-testing:$roomVersion"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.30"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-beta06'
    implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha07"
}

and these are the versions:

ext {
        compose_version = '1.0.0-beta07'
        activityVersion = '1.1.0'
        appCompatVersion = '1.2.0'
        constraintLayoutVersion = '2.0.2'
        coreTestingVersion = '2.1.0'
        coroutines = '1.3.9'
        lifecycleVersion = '2.3.1'
        materialVersion = '1.2.1'
        roomVersion = '2.3.0'
    }
Ryan M
  • 18,333
  • 31
  • 67
  • 74
Vahid
  • 1,829
  • 1
  • 20
  • 35

8 Answers8

27

Anyone using Navigation with compose should also update the navigation library to the latest available version.

In my case, I was using

    implementation "androidx.navigation:navigation-compose:1.0.0-alpha10"

and had to replace with

    implementation "androidx.navigation:navigation-compose:2.4.0-alpha01"
Ruben Hensen
  • 796
  • 1
  • 9
  • 24
Chintan Parmar
  • 2,375
  • 2
  • 12
  • 22
19

Your runtime-livedata dependency is outdated:

implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-beta06'

You should update that to use the same version as the rest of your Compose dependencies:

implementation "androidx.compose.runtime:runtime-livedata:$compose_version"

Which would be effectively:

implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-beta07'
Ryan M
  • 18,333
  • 31
  • 67
  • 74
4

For me, It was updating constraint layout compose version to 1.0.0-alpha07 androidx.constraintlayout:constraintlayout-compose:$constraint_layout_version

David Ibrahim
  • 2,777
  • 4
  • 17
  • 41
3

What worked for me was updating to

implementation("androidx.hilt:hilt-navigation-compose:1.0.0-alpha02")

and

implementation("com.google.accompanist:accompanist-swiperefresh:0.10.0")
Duncan Lukkenaer
  • 12,050
  • 13
  • 64
  • 97
1

Paging compose was required to update from 1.0.0-alpha07 to 1.0.0-alpha11

implementation "androidx.paging:paging-compose:1.0.0-alpha11"
Akhha8
  • 418
  • 3
  • 10
1

I have solved it by adding this dependency -

implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07'
Lalit Behera
  • 534
  • 8
  • 18
0

Solved it by using

def compose_version = '1.0.1'
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
Vasily Kabunov
  • 6,511
  • 13
  • 49
  • 53
lemonr
  • 1
0

Honestly, sometimes removing and readding the troubled component helps. For me, it was crashing on some optional parameter in a composable. I removed the parameter and readded it, and then it worked...

MikkelT
  • 633
  • 1
  • 10
  • 16