Navigation Architecture Component - DestinationFragmentArgs is not generated
The argument should be in the destination fragment as follows instead of inside the action in source fragment
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navigation_graph"
app:startDestination="@id/loginPhoneNumberFragment">
<fragment
android:id="@+id/loginPhoneNumberFragment"
android:name="...fragments.LoginPhoneNumberFragment"
android:label="@string/login_activity_title"
tools:layout="@layout/fragment_login_phone_number">
<action
android:id="@+id/action_loginPhoneNumberFragment_to_loginCodeFragment"
app:destination="@id/loginCodeFragment"/>
</fragment>
<fragment
android:id="@+id/loginCodeFragment"
android:name="...LoginCodeFragment"
android:label="@string/login_activity_title"
tools:layout="@layout/fragment_login_code">
<argument
android:name="prefix"
app:argType="string" />
<argument
android:name="phone_number"
app:argType="string" />
</fragment>
</navigation>
Ok, so after a lot of searching I found out my mistake - the arguments should be on the Destination fragment, and not on the starting one:
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navigation_graph"
app:startDestination="@id/loginPhoneNumberFragment">
<fragment
android:id="@+id/loginPhoneNumberFragment"
android:name="...fragments.LoginPhoneNumberFragment"
android:label="@string/login_activity_title"
tools:layout="@layout/fragment_login_phone_number">
<action
android:id="@+id/action_loginPhoneNumberFragment_to_loginCodeFragment"
app:destination="@id/loginCodeFragment">
</action>
</fragment>
<fragment
android:id="@+id/loginCodeFragment"
android:name="...fragments.LoginCodeFragment"
android:label="@string/login_activity_title"
tools:layout="@layout/fragment_login_code" >
<argument
android:name="prefix"
app:argType="string"
android:defaultValue="888" />
<argument
android:name="phone_number"
app:argType="string"
android:defaultValue="88888888"/>
</fragment>
</navigation>
You can also add it manually via the navigation graph design - press on the destination fragment and press "+" on the arguments section, it will add it to the text file.