【发布时间】:2020-04-09 14:45:08
【问题描述】:
我正在尝试使用 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"
【问题讨论】:
-
您是否构建了该项目?它们仅在您构建项目时生成。
-
是的,我重建并清理
标签: android android-fragments kotlin android-jetpack-navigation android-safe-args