Search code examples
androidandroid-architecture-navigationandroid-navigationandroid-safe-args

Updated the Navigation framework and getting error - "getActionId overrides nothing"


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?


Solution

  • 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.