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

Crash with Jetpack Compose Alpha07 #46

Closed
johnnycube opened this issue Nov 13, 2020 · 4 comments
Closed

Crash with Jetpack Compose Alpha07 #46

johnnycube opened this issue Nov 13, 2020 · 4 comments

Comments

@johnnycube
Copy link

Version of Jetpack Compose: alpha07
Version of Compose router: 0.21.0

The following runtime error is thrown

 java.lang.NoSuchFieldError: No field Companion of type Landroidx/compose/runtime/SlotTable$Companion; in class Landroidx/compose/runtime/SlotTable; or its superclasses (declaration of 'androidx.compose.runtime.SlotTable' appears in /data/data/com.metamythlabs.theseries/code_cache/.overlay/base.apk/classes.dex)
        at com.github.zsoltk.compose.router.RouterKt.Router(Router.kt:105)
        at com.metamythlabs.theseries.screens.MainRouter$Companion.Content(MainRouter.kt:28)

Usage of router (excerpt)

 companion object {
        @Composable
        fun Content(defaultRouting: Routing = Routing.Home) {
            Router("Main", defaultRouting) { backStack ->

                Providers(
                    AppNavigatorAmbient provides TheSeenNavigator(backStack)
                ) {
                    when (val routing = backStack.last()) {
                        is Routing.Home -> HomeRouter.Content()
                        is Routing.MoviesDetail -> MovieRouter.Content(movieId = routing.movieId)
                        is Routing.SeriesDetail -> SeriesRouter.Content(seriesId = routing.seriesId)
                        is Routing.UniverseDetail -> UniverseRouter.Content(universeId = routing.universeId)
                    }
                }
            }
        }
    }
}

Sadly I couldn't solve it quickly, hence I wanna report it.

@CaelumF
Copy link

CaelumF commented Nov 14, 2020

I'm getting this too

I tried cloning and updating to alpha07 and I can get it to compile, but when navigation changes I am seeing TableSlot errors.

Maybe we should be using https://developer.android.com/jetpack/compose/navigation nowadays anyway?

@zsoltk
Copy link
Owner

zsoltk commented Nov 16, 2020

Hello @johnnycube @CaelumF !

I've updated the library for alpha07 in #47 and released as 0.22.0. I couldn't reproduce the errors you reported – the sample apps work just fine with the same looking code.

Note that they've rewritten the slot table impl, so you might need a clean rebuild cycle for the errors to go away. Please let me know how it goes.

@johnnycube
Copy link
Author

I can confirm that updating the library and rebuilding the project is working. I cannot comment on what did the trick though.

@CaelumF
Copy link

CaelumF commented Nov 17, 2020

I am pretty sure that the error originally in this issue is just because compose-router was using an older compose, and the issue I was getting was actually a separate alpha07 issue involving onClick that I haven't narrowed down yet.

Nice one @zsoltk ! FYI I looked deeper into using compose-navigation and it seems a lot more complicated than this is (and currently android-specific) so thanks again for providing this :)

@johnnycube no need to keep the issue open on my behalf anymore if there's nothing else outstanding

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

3 participants