RuntimeException:异常充气Kotlin:Navigation/nav_graph
当我们将SafeArgs放入导航图中时,我们有一个Runtime Exception,此崩溃并没有为我们提供任何修复指南。 在第一印象中,我们正在遵循此过程,以确保这些班级是否是包裹的。
因此,这些班级正确地被包裹了,一切似乎都正确。
We had a RuntimeException while we put a safeArgs into the navigation graph and this crash didn't give us any more guide to fix it.
In the first impression, we were following this to ensure that those classes were Parcelize or not.
Therefore, those classes were parceled correctly and everything seems right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在对我们的代码进行了多次搜索和调查之后,我发现Safeargs类中存在于密封级文件中。
考虑到这一点,我们不能将包裹的注释分配给密封的类,我们决定将班级移到该密封的.kt文件之外。
虽然,我发现该运行时崩溃的主要原因是此原因。
另外,我在下面提供了错误和正确的案例,我们希望这对他人有帮助:
我们已经将userfavorite及其子类移动到wheSPT.kt文件之外,
将其移至一个独立的文件中:userfavorite.kt.kt
并且,响应
After many searches and investigations into our codes, I found that SafeArgs class exists in a sealed-class file.
Considering to this point that we can't allocate the parceled annotation to the sealed classes, we've decided to move our class outside of that sealed .kt file.
Although, I found the main reason for that runtime crash was this cause.
Also, I've provided the wrong and correct cases below, We hope this will be helpful to others:
We've moved the UserFavorite and its subclass, outside of the Response.kt file,
into an independent file for that: UserFavorite.kt
and, Respons.kt