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

[Bug] Crash at runtime with serialization error #725

Open
1 task done
EdricChan03 opened this issue Aug 26, 2024 · 1 comment
Open
1 task done

[Bug] Crash at runtime with serialization error #725

EdricChan03 opened this issue Aug 26, 2024 · 1 comment
Assignees
Labels
blocked Issues/PRs that are currently blocked by external factors. bug Bugs that have appeared in the release/ debug version of the app.

Comments

@EdricChan03
Copy link
Owner

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

When launching a nightly build of the app, it crashes at runtime.

Expected behaviour

The app should not crash at runtime, and should show a login dialog

Reproduction steps

  1. Install the latest nightly build
  2. Run the app
  3. The app should crash with an obfuscated version of the crash log above

Application variant

Release, Nightly

Application version

1.1.0

Application version code

Relevant log output

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.edricchan.studybuddy.nightly/com.edricchan.studybuddy.ui.modules.main.MainActivity}: sa.k: Serializer for class 'n' is not found.
Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.

       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3920)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4073)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
       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:2426)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:211)
       at android.os.Looper.loop(Looper.java:300)
       at android.app.ActivityThread.main(ActivityThread.java:8503)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)

Caused by sa.k: Serializer for class 'n' is not found.
Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.

       at kotlinx.serialization.internal.Platform_commonKt.serializerNotRegistered(Platform.common.kt:90)
       at kotlinx.serialization.SerializersKt__SerializersKt.serializer(Serializers.kt:299)
       at kotlinx.serialization.SerializersKt.serializer(Serializers.kt:1)
       at androidx.navigation.NavDestinationBuilder.<init>(NavDestinationBuilder.kt:91)
       at androidx.navigation.ActivityNavigatorDestinationBuilder.<init>(ActivityNavigatorDestinationBuilder.kt:101)
       at com.edricchan.studybuddy.navigation.compat.CompatNavigationKt.compatGraphs(CompatNavigation.kt:247)
       at com.edricchan.studybuddy.ui.modules.main.MainActivity.initNavGraph(MainActivity.kt:249)
       at com.edricchan.studybuddy.ui.modules.main.MainActivity.onCreate(MainActivity.kt:80)
       at android.app.Activity.performCreate(Activity.java:8589)
       at android.app.Activity.performCreate(Activity.java:8553)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1445)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3901)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4073)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
       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:2426)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:211)
       at android.os.Looper.loop(Looper.java:300)
       at android.app.ActivityThread.main(ActivityThread.java:8503)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)

Possible solution

When marking the nightly variant as debuggable (i.e. isDebuggable = true), adding a breakpoint to Platform.common.kt:90, and running the debuggable app, it reveals that the CompatDestination.DebugModalBottomSheet object couldn't be serialised:

Screenshot of IDE debugger with a breakpoint at Platform.common.kt:90, with the Threads and Variables tab open at the breakpoint, showing the CompatDestination.DebugModalBottomSheet object being referenced

Some comprehensive Google searching, asking around on the AndroidDev Discord server and some additional searches on Google's IssueTracker later, I finally found a relevant issue that was what I was facing: Issue 353898971.

I eventually noticed that the particular object wasn't actually used anywhere (the navigateToDebugModalBottomSheet DSL was unused, so CompatDestination.DebugModalBottomSheet was unused)

Additional context

No response

@EdricChan03 EdricChan03 added bug Bugs that have appeared in the release/ debug version of the app. blocked Issues/PRs that are currently blocked by external factors. labels Aug 26, 2024
@EdricChan03 EdricChan03 self-assigned this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Issues/PRs that are currently blocked by external factors. bug Bugs that have appeared in the release/ debug version of the app.
Projects
Status: Todo
Development

No branches or pull requests

5 participants
@EdricChan03 and others