java - 未知片段 & 无法启动一个或多个类
问题描述
这是我的 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@drawable/background"
tools:openDrawer="start">
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="@color/overlayBAckground"
app:itemTextColor="@android:color/white"
app:itemIconTint="@android:color/white"
app:headerLayout="@layout/nav_header_home"
app:menu="@menu/activity_home_drawer" />
<include
layout="@layout/app_bar_home"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.drawerlayout.widget.DrawerLayout>
在 gradle 依赖项中,我有这个:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:17.1.0'
implementation 'com.google.firebase:firebase-database:19.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.0.0'
implementation 'androidx.navigation:navigation-ui:2.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
def nav_version = "2.1.0-alpha01"
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
如果您需要更多信息,请在下方评论。我看过其他帖子,但没有一个解决方案也对我有用。也许我看的不够深入,但是如果您知道出了什么问题,请帮助我。
解决方案
推荐阅读
- java - 带有各种反斜杠转义序列的打印输出的输出
- php - PHP文件停止工作,没有对其进行任何更改
- javascript - 如何将构造函数值传递到 DOM
- java - 为什么即使存在 csv 文件也会出现 FileNotFoundException?
- python - tensorflow evalutaion 和 earlystopping 给出了无穷大的溢出错误
- functional-programming - 难以理解 OCAML 幂函数
- visual-studio-code - vscode集成终端重音不起作用?
- javascript - 松露合约部署卡住
- python - 从另一个列表中的一个列表中获取第一项
- java - 在多模块多数据源项目中指示将哪个数据源注入我的 DAO 的正确方法是什么?