Release构建开启minifyEnabled时出现ClassCastException求助
- 开启
minifyEnabled = true的Release构建中触发java.lang.ClassCastException异常,无法确定是androidx.lifecycle还是androidx.navigation.compose库导致问题 - 将Navigation Compose库从
2.6.*升级到2.7.1后出现该异常,因已适配其动画相关依赖变更,无法降级回旧版本 - 当前通过在
gradle.properties中添加android.enableR8.fullMode=false实现临时修复
异常堆栈信息
FATAL EXCEPTION: main Process: com.company_name.app_name, PID: 10694 java.lang.ClassCastException at a.g.z(SourceFile:1) at l6.h.get(SourceFile:198) at j8.c.b(SourceFile:136) at androidx.lifecycle.a.create(SourceFile:9) at j8.f.create(SourceFile:2) at n4.t.p(SourceFile:73) at n4.t.o(SourceFile:13) at n4.f.E(SourceFile:45) at n4.f.n0(SourceFile:24) at u2.c.j(SourceFile:155) at v7.a.a(SourceFile:33) at v7.a.W(SourceFile:35) at o0.b.b(SourceFile:51) at o0.b.W(SourceFile:9) at s.d0.a(SourceFile:58) at s.d0.d0(SourceFile:66) at o0.b.d0(SourceFile:59) at q7.a.c(SourceFile:182) at p0.h.a(SourceFile:114) at v2.l.f(SourceFile:70) at androidx.navigation.compose.m.a(SourceFile:38) at androidx.navigation.compose.m.d0(SourceFile:17) at o0.b.d0(SourceFile:59) at q7.a.c(SourceFile:182) at v2.l.b(SourceFile:53) at androidx.navigation.compose.o.W(SourceFile:126) at o0.b.b(SourceFile:51) at o0.b.W(SourceFile:9) at p.k.a0(SourceFile:144) at o0.b.a(SourceFile:51) at o0.b.a0(SourceFile:9) at z.x0.b(SourceFile:1812) at z.x0.c(SourceFile:385) at p.l.a(SourceFile:320) at p.l.d0(SourceFile:41) at o0.b.d0(SourceFile:59) at kotlinx.coroutines.c0.b(SourceFile:1045) at o5.a.k(SourceFile:265) at androidx.navigation.compose.q.a(SourceFile:81) at androidx.navigation.compose.q.d0(SourceFile:29) at h0.w.L(SourceFile:287) at h0.w.U(SourceFile:58) at h0.w.r(SourceFile:166) at h0.w.K(SourceFile:36) at h0.c0.w(SourceFile:19) at h0.j2.o(SourceFile:96) at h0.g2.m0(SourceFile:363) at androidx.compose.ui.platform.u0.doFrame(SourceFile:7) at androidx.compose.ui.platform.s0.doFrame(SourceFile:48) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1229) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239) at android.view.Choreographer.doCallbacks(Choreographer.java:899) at android.view.Choreographer.doFrame(Choreographer.java:827) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7872) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) Suppressed: kotlinx.coroutines.j0: [h0.o1@694f452, androidx.compose.ui.platform.s1@9493323, t1{Cancelling}@1d1a020, t0@dcb1dd9]
内容的提问来源于stack exchange,提问作者user924
相关产品推荐
相关产品推荐

