google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.38k stars 596 forks source link

was AnimatedContentScope replaced correctely with AnimatedContentTransitionScope in the new Updates ? #1560

Closed DzartXStudio closed 1 year ago

DzartXStudio commented 1 year ago

i keep getting that the deprecated class AnimatedContentScope was not found and i already replaced it by AnimatedContentTransitionScope error ; E/AndroidRuntime: FATAL EXCEPTION: main Process: com.dzartxstudio.mybookofrhymes, PID: 12602 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/animation/AnimatedContentScope; at com.google.accompanist.navigation.animation.AnimatedNavHostKt$AnimatedNavHost$7$1.invoke(AnimatedNavHost.kt:198) at androidx.compose.animation.AnimatedContentKt.AnimatedContent(AnimatedContent.kt:759) at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:196) at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:89) at com.dzartxstudio.mybookofrhymes.navigation.NavGraphKt.NavGraph(NavGraph.kt:34) at com.dzartxstudio.mybookofrhymes.presentation.MainActivity$onCreate$1$2.invoke(MainActivity.kt:68) at com.dzartxstudio.mybookofrhymes.presentation.MainActivity$onCreate$1$2.invoke(MainActivity.kt:65) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambda.jvm.kt:127) at androidx.compose.runtime.internal.ComposableLambdaImpl$invoke$1.invoke(ComposableLambda.jvm.kt:127) at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:162) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2443) at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2711) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3342) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3320) at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341) at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3320) at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3285) at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:772) at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1047) at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:124) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:541) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:510) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34) at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109) at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970) at android.view.Choreographer.doCallbacks(Choreographer.java:796) at android.view.Choreographer.doFrame(Choreographer.java:727) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@8dcee37, androidx.compose.ui.platform.MotionDurationScaleImpl@c305fa4, StandaloneCoroutine{Cancelling}@a94e10d, AndroidUiDispatcher@b03f8c2] E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.compose.animation.AnimatedContentScope" on path: DexPathList[[dex file "/data/data/com.dzartxstudio.mybookofrhymes/code_cache/.overlay/base.apk/classes11.dex", dex file "/data/data/com.dzartxstudio.mybookofrhymes/code_cache/.overlay/base.apk/classes8.dex", zip file "/data/app/IPqPGsvT8t3sgk4X3Aokdw==/com.dzartxstudio.mybookofrhymes-obV70S1XTUo9vYrpMuBZVA==/base.apk"],nativeLibraryDirectories=[/data/app/IPqPGsvT8t3sgk4X3Aokdw==/com.dzartxstudio.mybookofrhymes-obV70S1XTUo9vYrpMuBZVA==/lib/x86, /system/lib, /system_ext/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) ... 39 more

kafri8889 commented 1 year ago

i got the same problem

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/animation/AnimatedContentScope;

Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.compose.animation.AnimatedContentScope" on path: DexPathList...

Tgo1014 commented 1 year ago

Same issue here, any workaround?

rushmeh commented 1 year ago

Still having the same issue since past 4 days. Any updates?

hide-your-code commented 1 year ago

Having the same issue with compose version is 1.4.x and accompanist version is 0.30.0.

nglauber commented 1 year ago

I had the same issue using Compose 1.5.0-alpha01. Using compose 1.4.0 and Accompanist 0.30.0 worked for me.

ianhanniballake commented 1 year ago

Accompanist 0.30.0 is built against Compose 1.4.0 and uses the experimental APIs as they are written in Compose 1.4.0.

AnimatedContent (which was experimental in Compose 1.4) changed in an incompatible way in Compose Animation 1.5.0-alpha01. Thus any library built against Compose 1.4 that was using AnimatedContent won't work at all when used with Compose 1.5.

You'll need to make sure you aren't using anything from Compose 1.5 if you are using Accompanist 0.30.0 (as pulling in one library from Compose 1.5 will upgrade all Compose libraries).

This will be fixed as part of a new Accompanist release specifically targeting Compose 1.5.

DzartXStudio commented 1 year ago

Accompanist 0.30.0 is built against Compose 1.4.0 and uses the experimental APIs as they are written in Compose 1.4.0.

AnimatedContent (which was experimental in Compose 1.4) changed in an incompatible way in Compose Animation 1.5.0-alpha01. Thus any library built against Compose 1.4 that was using AnimatedContent won't work at all when used with Compose 1.5.

You'll need to make sure you aren't using anything from Compose 1.5 if you are using Accompanist 0.30.0 (as pulling in one library from Compose 1.5 will upgrade all Compose libraries).

This will be fixed as part of a new Accompanist release specifically targeting Compose 1.5.

Yup This error happened just after updating compose-version from 1.4.0 to 1.5.0-alpha01

sorry guys I fixed this issue yesterday by setting the Compose version back to 1.4.0 again but I forgot to

update it here

ianhanniballake commented 1 year ago

We'll use this to track the work needed to make Accompanist Navigation Animation compatible with Compose 1.5.0.

yogaboyCZ commented 1 year ago

Could not find androidx.compose:compose-bom:2023.04.00-alpha01

ah so

api(platform("dev.chrisbanes.compose:compose-bom:2023.04.00-alpha01"))

but there is also java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/animation/AnimatedContentScope;

iZakirSheikh commented 1 year ago

Still getting this error. This wasted my 4 days.

DzartXStudio commented 1 year ago

Still getting this error. This wasted my 4 days.

make sure that the compose-ui-version = 1.4.0 until they fix it

AndroidJohnsonWang commented 1 year ago

Just add the following configuration to the Module's Gradle: configurations.all { resolutionStrategy.force "androidx.compose.animation:animation:$compose_version" }

arulwastaken commented 1 year ago

Facing same issue

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/animation/AnimatedContentScope; at com.google.accompanist.navigation.animation.AnimatedNavHostKt$AnimatedNavHost$7$1.invoke(AnimatedNavHost.kt:198)

Dependency: ` App Gradle:

plugins {
    id("com.android.application") version "7.4.0" apply false
    id("com.android.library") version "7.4.0" apply false
    id("org.jetbrains.kotlin.android") version "1.8.0" apply false
    id("com.google.dagger.hilt.android") version "2.44" apply false
    kotlin("kapt") version "1.8.0"
} 

App: `

 compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = "17"
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.4.0"
    }

implementation(platform("androidx.compose:compose-bom:2023.05.01"))
implementation("com.google.accompanist:accompanist-navigation-animation:0.30.1")
mahdit83 commented 1 year ago

Accompanist 0.30.0 is built against Compose 1.4.0 and uses the experimental APIs as they are written in Compose 1.4.0.

AnimatedContent (which was experimental in Compose 1.4) changed in an incompatible way in Compose Animation 1.5.0-alpha01. Thus any library built against Compose 1.4 that was using AnimatedContent won't work at all when used with Compose 1.5.

You'll need to make sure you aren't using anything from Compose 1.5 if you are using Accompanist 0.30.0 (as pulling in one library from Compose 1.5 will upgrade all Compose libraries).

This will be fixed as part of a new Accompanist release specifically targeting Compose 1.5.

Is this kinda issue for dependencies management in compose? Why other component should suppress their version mentioned on Gradle and use 1.5 instead?

albaeportillo commented 5 months ago

This works for me

build.gradle.kts

configurations {
        all {
            resolutionStrategy.force("androidx.compose.animation:animation:1.4.0")
        }
    }