java - 如何修复(错误 : cannot find symbol class ActionOnlyNavDirections) with navigation architecture in Android studio

标签 java android android-architecture-navigation

我正在 Android studio 中使用导航架构组件。我将它与底部应用程序栏一起使用,它工作得很好,但是每当我尝试添加操作时,我都会在启动应用程序时收到此错误(错误:找不到符号类“ActionOnlyNavDirections”)

<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/nav_graph"
app:startDestination="@id/Around">

<fragment
    android:id="@+id/Around"
    android:name="com.Czynt.kazdoura.AroundFragment"
    android:label="fragment_around"
    tools:layout="@layout/fragment_around">
    <action
        android:id="@+id/action_Around_to_listView"
        app:destination="@id/listView" />

</fragment>
<fragment
    android:id="@+id/listView"
    android:name="com.Czynt.kazdoura.ListView"
    android:label="fragment_list_view"
    tools:layout="@layout/fragment_list_view" />
   </navigation>

 public class AroundFragment extends Fragment{
    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    TabItem listTab = getActivity().findViewById(R.id.listTab);
    listTab.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_Around_to_listView,null));

最佳答案

我更新了 android studio 和我的应用程序中的所有依赖项,它工作了

关于java - 如何修复(错误 : cannot find symbol class ActionOnlyNavDirections) with navigation architecture in Android studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56226766/

相关文章:

java - 如何重构重复的代码?

android - Android 上的 GStreamer 教程获取 RTSP 流的 'Unsupported profile for video/mp4v-es'

android - 我可以在导航组件中使用多个 NavHostFragment 吗?

android - 停止持久调试 Hook

android - 如何让 android 导航编辑器在多个屏幕上工作

android - 使用 Android Navigation Architecture Component 重新创建 backstack

Red Hat 服务器中的 java.lang.IllegalArgumentException

java - swing - 如何设置为选项卡式 Pane 分配选项卡按钮?

java - Spring Boot cron 表达式问题 - 禁用启动时运行

java - 从 ContentProviderResult[] 中删除失败还是成功?