android / nowinandroid

A fully functional Android app built entirely with Kotlin and Jetpack Compose
Apache License 2.0
16.98k stars 3.1k forks source link

[Bug]: DemoRelease runtime error on interest screen #1595

Closed Jaehwa-Noh closed 2 months ago

Jaehwa-Noh commented 2 months ago

Is there an existing issue for this?

Is there a StackOverflow question about this issue?

What happened?

Build variants: demoRelease This happened after had been merged #1413 .

https://github.com/user-attachments/assets/00b26cca-bb92-4768-ae6c-ea44d0a88f65

It worked on 371e181b79ebcca4d7b38e24b800143025ae96f9.

Relevant logcat output

2024-09-05 22:08:37.431  6315-6315  AndroidRuntime          <pre-initialized>                    E  FATAL EXCEPTION: main
                                                                                                    Process: com.google.samples.apps.nowinandroid.demo, PID: 6315
                                                                                                    X6.f: Serializer for class 'c' is not found.
                                                                                                    Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.

                                                                                                        at b7.b0.h(SourceFile:26)
                                                                                                        at K3.a.N(SourceFile:13)
                                                                                                        at b2.x.<init>(SourceFile:8)
                                                                                                        at b2.A.<init>(SourceFile:26)
                                                                                                        at H2.v.e(SourceFile:16)
                                                                                                        at Z5.f.h(SourceFile:236)
                                                                                                        at g0.a.a(SourceFile:44)
                                                                                                        at g0.a.h(SourceFile:9)
                                                                                                        at T.n.h(SourceFile:98)
                                                                                                        at g0.a.a(SourceFile:44)
                                                                                                        at g0.a.h(SourceFile:9)
                                                                                                        at androidx.compose.animation.a.a(SourceFile:1523)
                                                                                                        at androidx.compose.animation.a.e(SourceFile:230)
                                                                                                        at androidx.compose.animation.a.b(SourceFile:170)
                                                                                                        at androidx.compose.material3.adaptive.layout.a.a(SourceFile:291)
                                                                                                        at Z5.f.h(SourceFile:69)
                                                                                                        at g0.a.a(SourceFile:44)
                                                                                                        at g0.a.h(SourceFile:9)
                                                                                                        at T.F.i(SourceFile:251)
                                                                                                        at g0.a.i(SourceFile:52)
                                                                                                        at H.s0.i(SourceFile:1266)
                                                                                                        at g0.a.i(SourceFile:52)
                                                                                                        at T.H.h(SourceFile:303)
                                                                                                        at g0.a.a(SourceFile:44)
                                                                                                        at C.G.i(SourceFile:141)
                                                                                                        at Y.p.E(SourceFile:451)
                                                                                                        at Y.p.N(SourceFile:29)
                                                                                                        at I0.e0.a(SourceFile:35)
                                                                                                        at n7.d.T(SourceFile:591)
                                                                                                        at T.E.i(SourceFile:43)
                                                                                                        at Y.p.E(SourceFile:451)
                                                                                                        at Y.p.L(SourceFile:137)
                                                                                                        at Y.p.o(SourceFile:238)
                                                                                                        at Y.p.D(SourceFile:30)
                                                                                                        at Y.t.u(SourceFile:23)
                                                                                                        at Y.t0.p(SourceFile:103)
                                                                                                        at Y.r0.j(SourceFile:564)
                                                                                                        at L0.d0.doFrame(SourceFile:34)
                                                                                                        at L0.b0.doFrame(SourceFile:48)
                                                                                                        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1404)
                                                                                                        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
                                                                                                        at android.view.Choreographer.doCallbacks(Choreographer.java:1015)
                                                                                                        at android.view.Choreographer.doFrame(Choreographer.java:941)
                                                                                                        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1389)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:959)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:100)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                        at android.os.Looper.loop(Looper.java:317)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8699)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
                                                                                                        Suppressed: Q6.g: [L0.e0@6b66b49, L0.D0@3d21c4e, x0{Cancelling}@76a016f, c0@f6c9e7c]

Code of Conduct

dturner commented 2 months ago

Thanks for spotting this. Investigating now.

dturner commented 2 months ago

This is caused by https://issuetracker.google.com/353898971. Workaround is to use @Keep on any routes which aren't referenced directly in code.

In this case, we have:

@Serializable data object DetailPaneNavHostRoute

NavHost(..., route = DetailPaneNavHostRoute::class)

nestedNavController.navigateToTopic(topicId) {
    popUpTo<DetailPaneNavHostRoute>()
}

So the class reference and the type parameter (presumably) aren't enough to stop DetailPaneNavHostRoute being removed during minification.

Jaehwa-Noh commented 2 months ago

@dturner Thanks for sharing a reason of error and resolve it.