airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.1k stars 107 forks source link

Can't open category in showcase browser #310

Closed RadoslawGorczyca closed 1 year ago

RadoslawGorczyca commented 1 year ago

When I open showkase browser I can see categories correctly, but when I click on one, the screen title changes, but rest of the screen stays the same, still showing the same categories. Then no matter how many times I click on category - nothing changes. When I press physical back button, the app crashes. Error I see:

E/MessageQueue-JNI: java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=android-app://androidx.navigation/SHOWKASE_CATEGORIES } cannot be found in the navigation graph NavGraph(0x0) startDestination={Destination(0x7bb10103) route=COMPONENT_GROUPS}

I would really appreciate some help.

polivmi1 commented 1 year ago

Same problem 1.0.0-beta18, but no logs nor crash.

Screenshot 2023-03-28 at 22 23 50
vinaygaba commented 1 year ago

@oas004 Do you think it could be related to any of your recent changes?

vinaygaba commented 1 year ago

This is also a suspicious PR that could impact this behavior - https://github.com/airbnb/Showkase/pull/222 We do have UI Tests to cover some of the basic use cases.

oas004 commented 1 year ago

I tried it out in the sample app in the project, is that screenshot above from the project you sent me @polivmi1 ? Or from another internal project? :)

I can't quite imagine what can cause this, but I will debug it further

oas004 commented 1 year ago

I tried also removing all the typography as that is in the screenshot, but I can't reproduce it :(

polivmi1 commented 1 year ago

@oas004 I have quickly tried adding more stuff to the sample (+fixing the context to run it) and with colors or more previews and combinations I wasn't able to reproduce. I guess there will be some preview composable that has problems. Is there any way to allow or see more logs from Showkase? I will try tomorrow to see if I can reduce my project to the way when it starts to work...

polivmi1 commented 1 year ago

Ending up only with 1 Preview it still fails, so this must be some set-up stuff - maybe gradle build variants generation...I can look into it more tomorrow

@Preview
@Composable
fun TextPreview() {
    Text("text")
}
Screenshot 2023-03-28 at 23 15 58
polivmi1 commented 1 year ago

I was able to reproduce same crash as mentioned by the author. Still can't get a smaller reproducible sample. I wonder if this is correct "uri=android-app://androidx.navigation/SHOWKASE_CATEGORIES" and shouldn't it have the app package name there.

FATAL EXCEPTION: main
         Process: , PID: 12034
         java.lang.IllegalArgumentException: Navigation destination that matches request NavDeepLinkRequest{ uri=android-app://androidx.navigation/SHOWKASE_CATEGORIES } cannot be found in the navigation graph NavGraph(0x0) startDestination={Destination(0xb29e665d) route=COLOR_GROUPS}
                                                                                                        at androidx.navigation.NavController.navigate(NavController.kt:1775)
                                                                                                        at androidx.navigation.NavController.navigate(NavController.kt:2173)
                                                                                                        at androidx.navigation.NavController.navigate$default(NavController.kt:2168)
                                                                                                        at com.airbnb.android.showkase.ui.ShowkaseBrowserAppKt.navigate(ShowkaseBrowserApp.kt:558)
                                                                                                        at com.airbnb.android.showkase.ui.ShowkaseCategoriesScreenKt.goBackToCategoriesScreen(ShowkaseCategoriesScreen.kt:90)
                                                                                                        at com.airbnb.android.showkase.ui.ShowkaseGroupsScreenKt$ShowkaseGroupsScreen$2.invoke(ShowkaseGroupsScreen.kt:52)
                                                                                                        at com.airbnb.android.showkase.ui.ShowkaseGroupsScreenKt$ShowkaseGroupsScreen$2.invoke(ShowkaseGroupsScreen.kt:51)
                                                                                                        at com.airbnb.android.showkase.ui.BackButtonHandlerKt$BackButtonHandler$1$1$1.invoke(BackButtonHandler.kt:69)
                                                                                                        at com.airbnb.android.showkase.ui.BackButtonHandlerKt$BackButtonHandler$1$1$1.invoke(BackButtonHandler.kt:68)
                                                                                                        at com.airbnb.android.showkase.ui.ComposableBackHandler.handleOnBackPressed(BackButtonHandler.kt:25)
                                                                                                        at androidx.activity.OnBackPressedDispatcher.onBackPressed(OnBackPressedDispatcher.kt:213)
                                                                                                        at androidx.activity.ComponentActivity.onBackPressed(ComponentActivity.java:693)
                                                                                                        at android.app.Activity.onKeyUp(Activity.java:3882)
                                                                                                        at android.view.KeyEvent.dispatch(KeyEvent.java:2925)
                                                                                                        at android.app.Activity.dispatchKeyEvent(Activity.java:4228)
                                                                                                        at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:126)
                                                                                                        at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:86)
                                                                                                        at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:144)
                                                                                                        at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:604)
                                                                                                        at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:60)
                                                                                                        at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:3413)
                                                                                                        at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:402)
                                                                                                        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6584)
                                                                                                        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6450)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5910)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5967)
                                                                                                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5933)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6098)
                                                                                                        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5941)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6155)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5914)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5967)
                                                                                                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5933)
                                                                                                        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5941)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5914)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5967)
                                                                                                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5933)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6131)
                                                                                                        at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6311)
                                                                                                        at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3649)
                                                                                                        at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:3169)
                                                                                                        at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:3160)
polivmi1 commented 1 year ago

Reverting the showkase version shows the same problem, so it isn't a 1.0.0-beta18 problem, but some project configuration that got updated and broke the showkase lib navigation. (previously it worked with 1.0.0-beta17)

polivmi1 commented 1 year ago

@oas004 this is related to https://github.com/raamcosta/compose-destinations/releases where most likely some dependencies got overwritten due to mismatching compose or other setup versions. That then caused this strange behavior. 1.8.36-beta of that library doesn't work, but 1.8.38-beta works normally. (same will be most likely with the native compose destination or accompanist dependency) So from my side, this can be marked as resolved.

oas004 commented 1 year ago

hmm, okay. I don't know if I quite got that. Is it because you are using the compose-destination library and we are transitively downgrading it? 🤔 @RadoslawGorczyca Could you verify that updating that library solves the issue for you as well?

RadoslawGorczyca commented 1 year ago

I managed to find the cause for this problem. Recently in my project there was libraries update, which caused showkase to stop working correctly. I checked all of them and it seems that updating accompanist from 0.29.1-alpha to 0.29.2-rc and navigation-compose from 2.6.0-alpha05 to 2.6.0-alpha07 are what caused the issue. Reverting those updates fixed it.

AhmedAshour commented 11 months ago

I encountered the same issue and none of the suggested solutions worked for me. However, I found a solution that resolved the problem, and I'd like to share it in case it helps others facing a similar issue.

I'm using Showkase version 1.0.2.

The issue was related to the navigation-compose library (I also have Accompanist, but it wasn't causing the problem). I initially had version 2.6.0 of navigation-compose, but after updating it to 2.7.0-alpha01 or later versions, the problem was resolved, and everything works as expected now.

@vinaygaba I suggest to add a section at the end of Readme saying troubleshooting or something and mention the fixes people find for such problem as it can be time consuming for others if they face it in the future. I can make a PR if you find it useful.