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

NoSuchMethodError: No static method HorizontalPager #8

Open
jeancsanchez opened this issue Jun 1, 2024 · 9 comments
Open

NoSuchMethodError: No static method HorizontalPager #8

jeancsanchez opened this issue Jun 1, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@jeancsanchez
Copy link

jeancsanchez commented Jun 1, 2024

Hi!

First of all thank you for this awesome library.

I'm just trying to use a basic example of this library in my Multiplatform project but I'm getting that error.
I'm using Kotlin 2.0.0 and version 1.0.0 of this library.
This is my sample code:

Screenshot 2024-06-01 at 02 43 31

and this is the error thrown when I start the screen:

java.lang.NoSuchMethodError: No static method HorizontalPager-xYaah8o(Landroidx/compose/foundation/pager/PagerState;Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/pager/PageSize;IFLandroidx/compose/ui/Alignment$Vertical;Landroidx/compose/foundation/gestures/snapping/SnapFlingBehavior;ZZLkotlin/jvm/functions/Function1;Landroidx/compose/ui/input/nestedscroll/NestedScrollConnection;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V in class Landroidx/compose/foundation/pager/PagerKt; or its super classes (declaration of 'androidx.compose.foundation.pager.PagerKt' appears in /data/app/~~SQRfAPj5kOyhjY82ncDh3A==/br.com.jeancsanchez.igenda-1ihfZ5XZZidtDbit0FsCbg==/base.apk)
                                                                                                     	at io.wojciechosak.calendar.view.WeekViewKt.WeekView(WeekView.kt:91)
                                                                                                     	at ui.features.establishment.EstablishmentDetailsViewKt.EstablishmentDetailsView(EstablishmentDetailsView.kt:35)
                                                                                                     	at ui.AppKt$App$2$1$5.invoke(App.kt:85)
                                                                                                     	at ui.AppKt$App$2$1$5.invoke(App.kt:81)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:139)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                     	at androidx.navigation.compose.NavHostKt$NavHost$22$1.invoke(NavHost.kt:483)
                                                                                                     	at androidx.navigation.compose.NavHostKt$NavHost$22$1.invoke(NavHost.kt:481)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                     	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:250)
                                                                                                     	at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
                                                                                                     	at androidx.navigation.compose.NavBackStackEntryProviderKt.SaveableStateProvider(NavBackStackEntryProvider.kt:65)
                                                                                                     	at androidx.navigation.compose.NavBackStackEntryProviderKt.access$SaveableStateProvider(NavBackStackEntryProvider.kt:1)
                                                                                                     	at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:52)
                                                                                                     	at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:51)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                     	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:229)
                                                                                                     	at androidx.navigation.compose.NavBackStackEntryProviderKt.LocalOwnersProvider(NavBackStackEntryProvider.kt:47)
                                                                                                     	at androidx.navigation.compose.NavHostKt$NavHost$22.invoke(NavHost.kt:481)
                                                                                                     	at androidx.navigation.compose.NavHostKt$NavHost$22.invoke(NavHost.kt:464)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:139)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                     	at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:755)
                                                                                                     	at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1$5.invoke(AnimatedContent.kt:744)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                     	at androidx.compose.animation.AnimatedVisibilityKt.AnimatedEnterExitImpl(AnimatedVisibility.kt:819)
                                                                                                     	at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:726)
                                                                                                     	at androidx.compose.animation.AnimatedContentKt$AnimatedContent$6$1.invoke(AnimatedContent.kt:709)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
                                                                                                     	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
                                                                                                        at androidx.compose.animation.AnimatedContentKt.AnimatedContent(AnimatedContent.kt:768)
                                                                                                     	at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:441)
                                                                                                     	at androidx.navigation.compose.NavHostKt$NavHost$24.invoke(Unknown Source:29)
                                                                                                     	at androidx.navigation.compose.NavHostKt$NavHost$24.invoke(Unknown Source:10)
                                                                                                     	at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:192)
                                                                                                     	at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2761)
                                                                                                     	at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3052)
                                                                                                     	at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3543)
                                                                                                     	at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3488)
                                                                                                     	at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:948)
                                                                                                     	at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1196)
                                                                                                     	at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:130)
                                                                                                     	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:607)
                                                                                                     	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:576)
                                                                                                     	at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41)
                                                                                                     	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:1229)
                                                                                                     	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
                                                                                                     	at android.view.Choreographer.doCallbacks(Choreographer.java:899)
                                                                                                     	at android.view.Choreographer.doFrame(Choreographer.java:827)
                                                                                                     	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
                                                                                                     	at android.os.Handler.handleCallback(Handler.java:942)
                                                                                                     	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                     	at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                     	at android.os.Looper.loop(Looper.java:288)
                                                                                                     	at android.app.ActivityThread.main(ActivityThread.java:7872)
                                                                                                     	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                     	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                     	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
                                                                                                     	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@58579ae, androidx.compose.ui.platform.MotionDurationScaleImpl@f7c034f, StandaloneCoroutine{Cancelling}@ee9aadc, AndroidUiDispatcher@db4f7e5]
@WojciechOsak
Copy link
Owner

Hey! Could you share your application libraries list with versions ? I wonder if that's some kind of dependency conflict

@WojciechOsak
Copy link
Owner

Hey again @jeancsanchez I find out that compose version in gradle was set to 1.5.11 so it could generate such issue 😬
Library was updated, and 1.0.1 version with fix will be ready in next couple hours to download. Let me know if it works for you!

@jeancsanchez
Copy link
Author

jeancsanchez commented Jun 1, 2024

@WojciechOsak thank you for the quick response.

I updated to 1.0.1 but the error persists.
Here libraries versions that I'm using:

Screenshot 2024-06-01 at 15 40 56 Screenshot 2024-06-01 at 15 42 59

@WojciechOsak
Copy link
Owner

Did u try clean build ?

@jeancsanchez
Copy link
Author

Yes, I did :/

@WojciechOsak WojciechOsak self-assigned this Jun 1, 2024
@WojciechOsak WojciechOsak added the bug Something isn't working label Jun 1, 2024
@WojciechOsak
Copy link
Owner

@jeancsanchez ok then, is there any chance that you can prepare minimal reproducible project ?
Is it possible that you get your whole project, remove all the files with your code and leave only one screen with WeekView implementation ? It should crash there, you will not send any confidential files, and we will have option to verify what is going on in the project 🤔

@GimazDo
Copy link

GimazDo commented Oct 31, 2024

Hi!

Minimal reproducible project: https://github.com/GimazDo/KMPExample
You can find project by path: /examples/calendar

@andrey-ananiev
Copy link
Contributor

I can't start Calendar :(

FATAL EXCEPTION: main Process: ru.keytomyself.customeraccounting, PID: 9362 java.lang.NoSuchMethodError: No static method HorizontalPager-xYaah8o(Landroidx/compose/foundation/pager/PagerState;Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/pager/PageSize;IFLandroidx/compose/ui/Alignment$Vertical;Landroidx/compose/foundation/gestures/snapping/SnapFlingBehavior;ZZLkotlin/jvm/functions/Function1;Landroidx/compose/ui/input/nestedscroll/NestedScrollConnection;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V in class Landroidx/compose/foundation/pager/PagerKt; or its super classes (declaration of 'androidx.compose.foundation.pager.PagerKt' appears in /data/app/~~Q4YQXngzZZqte6w4x5JR9Q==/ru.keytomyself.customeraccounting-eNQAKdUyau_KdAmnv8QJHQ==/base.apk) at io.wojciechosak.calendar.view.HorizontalCalendarViewKt.HorizontalCalendarView(HorizontalCalendarView.kt:60)

[versions] agp = "8.3.2" calendar = "1.0.1" kotlin = "2.0.21" compose = "1.7.0" activity-compose = "1.9.3"

@andrey-ananiev
Copy link
Contributor

I downloaded your library with an example. I upgraded Compose to 1.7.0. The example worked fine after I made minimal changes:

`package io.wojciechosak.calendar.view

HorizontalPager(
state = pagerState,
modifier = modifier,
pageSize = pageSize,
beyondViewportPageCount = beyondBoundsPageCount,
contentPadding = contentPadding,
) {
val index = it - INITIAL_PAGE_INDEX
calendarAnimator.updatePagerState(pagerState)
LaunchedEffect(Unit) {
calendarAnimator.setAnimationMode(CalendarAnimator.AnimationMode.MONTH)
}
Column { calendarView(index) }
}
`

Replaced the name of the HorizontalPager function parameter beyondBoundsPageCount with beyondViewportPageCount.
And the same thing in the VerticalPager function.

Please release a new version of the library for Compose version 1.7.0 I would greatly appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants