更新了导航框架并出现错误 - “getActionId overrides nothing"; [英] Updated the Navigation framework and getting error - "getActionId overrides nothing"
问题描述
我已将导航框架从 2.3.5 更新到 2.4.0-alpha01 版本.我将它与 Safe Args gradle 插件一起使用.更新后,我开始收到 'getActionId' overrides nothing
和 'getArguments' overrides nothing
错误.
我认为这是因为在生成 Direction 类时,Safe Args 错误地覆盖了 NavDirections
的 actionId
和 arguments
字段.>
例如,这是正在生成的内容:
public override fun getActionId(): Int =R.id.action_navigation_articles_to_articleReaderFragment
这是应该生成的:
public override val actionId: Int = R.id.action_navigation_articles_to_articleReaderFragment
如何获得 Safe Args 以生成正确的构建器类?
原来这是一个已知的错误 一段时间.
在我发布这个问题一天后,2.4.0-alpha02 Navigation 已发布并修复了此错误:
<块引用>Safe Args 在尝试生成方向时不再崩溃Kotlin 中的属性.(Id2416, b/188564435)
只需更新到 2.4.0-alpha02 版本即可修复.
I have updated the Navigation framework from 2.3.5 to the 2.4.0-alpha01 version. I use it with Safe Args gradle plugin. After update, I started getting 'getActionId' overrides nothing
and 'getArguments' overrides nothing
errors.
I think this is happening because Safe Args is overriding the actionId
and arguments
fields of NavDirections
improperly when generating the Direction classes.
For example, this is what is being generated:
public override fun getActionId(): Int =
R.id.action_navigation_articles_to_articleReaderFragment
This is what should be generated:
public override val actionId: Int = R.id.action_navigation_articles_to_articleReaderFragment
How can I get the Safe Args to generate proper builder classes?
Turns out this was a known bug for some time.
And right after a day after I posted this question, 2.4.0-alpha02 Navigation was released with a fix for this bug:
Safe Args no longer crashes when attempting to generate direction properties in Kotlin. (Id2416, b/188564435)
Just update to 2.4.0-alpha02 version for a fix.
这篇关于更新了导航框架并出现错误 - “getActionId overrides nothing";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!