我正在尝试使用 Safe Args 从 GameFragment 导航到 GameWonFragment。但是没有生成 GameFragmentDirections 类。
<fragment
android:id="@+id/gameFragment"
android:name="com.example.trivia.GameFragment"
android:label="@string/android_trivia"
tools:layout="@layout/fragment_game"
>
<action
android:id="@+id/action_gameFragment_to_gameWonFragment"
app:destination="@id/gameWonFragment"
app:popUpTo="@id/gameFragment"
app:popUpToInclusive="true" />
<action
android:id="@+id/action_gameFragment_to_gameOverFragment"
app:destination="@id/gameOverFragment"
app:popUpTo="@id/gameFragment" />
</fragment>
项目模块 Gradle
navigation_version = "2.3.0-alpha04"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"
应用 Gradle
apply plugin: "androidx.navigation.safeargs"