airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements

Home Page:https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fatal Exception: java.lang.RuntimeException: Unable to start activity ShowkaseBrowserActivity

Monabr opened this issue · comments

commented

Hello.

With each of my releases, bots come to me and launch ShowkaseBrowserActivity, it crashes and I get bad statistics. Is there any way to fix this?

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{.../com.airbnb.android.showkase.ui.ShowkaseBrowserActivity}: com.airbnb.android.showkase.exceptions.ShowkaseException: Missing key in bundle. Please start this activity by using the intent returned by the ShowkaseBrowserActivity.getIntent() method.
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7656)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Are you manually starting the activity? You are supposed to start this activity using the ShowkaseBrowserActivity.getIntent() method. Is that what you used?

commented

@vinaygaba I am not using this activity, some bots launch it in my code. I am not manually starting the activity.

@Monabr In that case, this activity isn't being started correctly as it needs more information to work correctly. This is an intentional failure -

"Missing key in bundle. Please start this activity by using the intent returned by " +

Is there a way where you can pass additional information when this activity is started (or how this activity is started)? I suspect you do?

commented

@vinaygaba I am not using this activity, I am not starting it. Some other people's bots, which I have nothing to do with, enter my application and launch this activity.

@Monabr Not sure how to help here if these bots are starting the activity incorrectly. I have no control over this, library is doing the right thing as it's designed to.

commented

@vinaygaba We need to remove this activity from the release build; it is absolutely unnecessary there, has no use and causes problems. Or do something about this crashes so that it does not spoil the statistics.

You can make Showkase only available in debug builds. Make sure your setup looks like this -

debugImplementation "com.airbnb.android:showkase:1.0.2"
kspDebug "com.airbnb.android:showkase-processor:1.0.2"

implementation "com.airbnb.android:showkase-annotation:1.0.2"
commented

@vinaygaba I don’t use your dependencies directly; they probably came to me along with the Jetpack Compose dependencies. How could I fix the situation?

@Monabr That's not possible. This library is an opt-in library and doesn't come by default if you use Jetpack Compose.

commented

@vinaygaba I have Lottie package with com.airbnb... maybe that activity comes from their dependencies? How could I fix the situation?

Lottie doesn't use Showkase so that's not possible either. I recommend spending some more time debugging as it's unrelated to the library itself and has probably something to do with your setup.

@Monabr I was able to understand the root cause of this issue -

It stems from your use of this library - https://github.com/marosseleng/compose-material3-datetime-pickers

It leverages Showkase in a way that uses it as an implementation dependency as opposed to debugImplementation like I recommended in this comment #366 (comment). If the library added a debug dependency on Showkase, it wouldn't be available in your release builds.

Moreover, this is happening because the ShowkaseBrowserActivity used to be incorrectly exported. This was fixed here - #355. However, a new release hasn't gone out since this fix was merged. So even though this issue has been fixed, it's not available yet (but will be with the new release). Hope that makes sense.