使用 Amplify 和 Android 导航复制 class
Duplicate class with Amplify and Android Navigation
我正在尝试使用 AWS Amplify,并且 Android 使用 Safe Args 导航 Java。我的项目编译正确,但在运行时崩溃。该错误表明问题出在导航 类 上,并且我在使用我使用的模块时发现导致冲突的另一个模块是 AWS Amplify 模块。我在 Official website 上读到,在这种情况下我应该删除导航库,因为它似乎已经包含在 Amplify 库中。如果删除 gradle 文件中的 implementation
行,我还能使用 Navigator 吗?还有另一种方法可以解决这个问题吗? objective 只是为了能够在同一项目中同时使用 Navigation 和 Amplify。谢谢你的帮助:)
我正在使用 Android Studio Bumblebee 2021.1.1 补丁 3,我的项目适用于 Android 8.1 (Oreo)。
我的应用级别build.gradle
文件是
plugins {
id 'com.android.application'
// Safe Args
id 'androidx.navigation.safeargs'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.myApplication"
minSdk 27
targetSdk 31
versionCode 1
versionName "0.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
// Support for Java 8 features (Amplify)
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// Navigation
def nav_version = "2.4.2"
// Java language implementation
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation "androidx.navigation:navigation-fragment:$nav_version"
// Lottie
def lottie_version = "5.0.3"
implementation "com.airbnb.android:lottie:$lottie_version"
// Amplify core dependency
def amplify_version = "1.35.3"
implementation "com.amplifyframework:core:$amplify_version"
// Support for Java 8 features
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.navigation:navigation-fragment:2.4.2'
implementation 'androidx.navigation:navigation-ui:2.4.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
项目级别build.gradle
:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
// Safe Args
id 'androidx.navigation.safeargs' version '2.4.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我还在 gradle.properties
中添加了 android.useAndroidX=true
和 android.enableJetifier=true
行。
错误:
Duplicate class androidx.navigation.ActivityKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavArgsLazyKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavArgsLazyKt$navArgs found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorDestinationBuilder found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorDestinationBuilderKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorExtrasKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.AnimBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavActionBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgsLazy found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgsLazyKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgumentBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavControllerKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDslBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDslBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDestinationBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDestinationDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels$backStackEntry found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels$storeProducer found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavHostKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavigatorProviderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.PopUpToBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.ViewKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.DialogFragmentNavigatorDestinationBuilder found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.DialogFragmentNavigatorDestinationBuilderKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavArgsLazyKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavArgsLazyKt$navArgs found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorDestinationBuilder found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorDestinationBuilderKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorExtrasKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.ui.ActivityKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$sam$i$androidx_navigation_ui_AppBarConfiguration_OnNavigateUpListener[=14=] found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.BottomNavigationViewKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.CollapsingToolbarLayoutKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.MenuItemKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.NavControllerKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.NavigationViewKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.ToolbarKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Go to the documentation to learn how to Fix dependency resolution errors.
您不能混合和匹配 navigation-fragment:2.4.2
(来自您的依赖项)和 navigation-fragment-ktx:2.3.4
(来自 Amplify)——所有导航工件都必须是同一版本。
因此只需更改您的依赖项以使用每个工件的 -ktx
版本,从而确保您具体依赖的版本与从 Amplify 中提取的版本相同。
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
我正在尝试使用 AWS Amplify,并且 Android 使用 Safe Args 导航 Java。我的项目编译正确,但在运行时崩溃。该错误表明问题出在导航 类 上,并且我在使用我使用的模块时发现导致冲突的另一个模块是 AWS Amplify 模块。我在 Official website 上读到,在这种情况下我应该删除导航库,因为它似乎已经包含在 Amplify 库中。如果删除 gradle 文件中的 implementation
行,我还能使用 Navigator 吗?还有另一种方法可以解决这个问题吗? objective 只是为了能够在同一项目中同时使用 Navigation 和 Amplify。谢谢你的帮助:)
我正在使用 Android Studio Bumblebee 2021.1.1 补丁 3,我的项目适用于 Android 8.1 (Oreo)。
我的应用级别build.gradle
文件是
plugins {
id 'com.android.application'
// Safe Args
id 'androidx.navigation.safeargs'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.myApplication"
minSdk 27
targetSdk 31
versionCode 1
versionName "0.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
// Support for Java 8 features (Amplify)
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// Navigation
def nav_version = "2.4.2"
// Java language implementation
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation "androidx.navigation:navigation-fragment:$nav_version"
// Lottie
def lottie_version = "5.0.3"
implementation "com.airbnb.android:lottie:$lottie_version"
// Amplify core dependency
def amplify_version = "1.35.3"
implementation "com.amplifyframework:core:$amplify_version"
// Support for Java 8 features
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.navigation:navigation-fragment:2.4.2'
implementation 'androidx.navigation:navigation-ui:2.4.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
项目级别build.gradle
:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
// Safe Args
id 'androidx.navigation.safeargs' version '2.4.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我还在 gradle.properties
中添加了 android.useAndroidX=true
和 android.enableJetifier=true
行。
错误:
Duplicate class androidx.navigation.ActivityKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavArgsLazyKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavArgsLazyKt$navArgs found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorDestinationBuilder found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorDestinationBuilderKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.ActivityNavigatorExtrasKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.AnimBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavActionBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgsLazy found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgsLazyKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavArgumentBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavControllerKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDslBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDeepLinkDslBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDestinationBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavDestinationDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels$backStackEntry found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavGraphViewModelLazyKt$navGraphViewModels$storeProducer found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.NavHostKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsBuilderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavOptionsDsl found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.NavigatorProviderKt found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.PopUpToBuilder found in modules navigation-common-2.4.2-runtime (androidx.navigation:navigation-common:2.4.2) and navigation-common-ktx-2.3.4-runtime (androidx.navigation:navigation-common-ktx:2.3.4)
Duplicate class androidx.navigation.ViewKt found in modules navigation-runtime-2.4.2-runtime (androidx.navigation:navigation-runtime:2.4.2) and navigation-runtime-ktx-2.3.4-runtime (androidx.navigation:navigation-runtime-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.DialogFragmentNavigatorDestinationBuilder found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.DialogFragmentNavigatorDestinationBuilderKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavArgsLazyKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavArgsLazyKt$navArgs found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorDestinationBuilder found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorDestinationBuilderKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.fragment.FragmentNavigatorExtrasKt found in modules navigation-fragment-2.4.2-runtime (androidx.navigation:navigation-fragment:2.4.2) and navigation-fragment-ktx-2.3.4-runtime (androidx.navigation:navigation-fragment-ktx:2.3.4)
Duplicate class androidx.navigation.ui.ActivityKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$AppBarConfiguration found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.AppBarConfigurationKt$sam$i$androidx_navigation_ui_AppBarConfiguration_OnNavigateUpListener[=14=] found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.BottomNavigationViewKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.CollapsingToolbarLayoutKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.MenuItemKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.NavControllerKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.NavigationViewKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Duplicate class androidx.navigation.ui.ToolbarKt found in modules navigation-ui-2.4.2-runtime (androidx.navigation:navigation-ui:2.4.2) and navigation-ui-ktx-2.3.4-runtime (androidx.navigation:navigation-ui-ktx:2.3.4)
Go to the documentation to learn how to Fix dependency resolution errors.
您不能混合和匹配 navigation-fragment:2.4.2
(来自您的依赖项)和 navigation-fragment-ktx:2.3.4
(来自 Amplify)——所有导航工件都必须是同一版本。
因此只需更改您的依赖项以使用每个工件的 -ktx
版本,从而确保您具体依赖的版本与从 Amplify 中提取的版本相同。
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'