Android 类型com.google.gson.ExclutionStrategy被多次定义

Android 类型com.google.gson.ExclutionStrategy被多次定义,android,gradle,build,build.gradle,contentful,Android,Gradle,Build,Build.gradle,Contentful,当我尝试将一个实现添加到我的应用程序的gradle文件时,我遇到了这个错误 我的中间dex文件中似乎有什么东西在发生。以下是全部错误: Error: /Users/ceddings/StudioProjects/r15-android-rms-kiosk-launcher/kiosk/build/intermediates/mixed_scope_dex_archive/debug/out/2fcf9ca3ebe4bba6e5de15039706dbd823b837def40fd130c6d32

当我尝试将一个实现添加到我的应用程序的gradle文件时,我遇到了这个错误

我的中间dex文件中似乎有什么东西在发生。以下是全部错误:

Error: /Users/ceddings/StudioProjects/r15-android-rms-kiosk-launcher/kiosk/build/intermediates/mixed_scope_dex_archive/debug/out/2fcf9ca3ebe4bba6e5de15039706dbd823b837def40fd130c6d32dbf72d7d3fe_1.jar:classes.dex, Type com.google.gson.ExclusionStrategy is defined multiple times: /Users/ceddings/StudioProjects/r15-android-rms-kiosk-launcher/kiosk/build/intermediates/mixed_scope_dex_archive/debug/out/2fcf9ca3ebe4bba6e5de15039706dbd823b837def40fd130c6d32dbf72d7d3fe_1.jar:classes.dex, /Users/ceddings/StudioProjects/r15-android-rms-kiosk-launcher/kiosk/build/intermediates/mixed_scope_dex_archive/debug/out/1c3715710bef6d11c4bd58c73e056adcb809f2dac72c25d60ee538a9010444f0_1.jar:classes.dex
下面是我的gradle文件。我如何解决这个问题

dependencies {
implementation project(':sharedcore')
implementation project(':data')
implementation project(':scanner')

implementation deps.kotlin.kotlin_jre
implementation deps.android.app_compat
implementation deps.android.material
implementation deps.android.constraint_layout
implementation deps.logging.timber
implementation deps.retrofit.retrofit
implementation deps.retrofit.retrofit_moshi
implementation deps.moshi.moshi
implementation deps.koin.koin_viewmodel
implementation deps.kotlin.coroutines_core
implementation deps.kotlin.coroutines_android
implementation(deps.auth.adal) {
    exclude group: 'com.android.support', module: 'appcompat-v7'
    exclude group: 'com.google.code.gson', module: 'gson'
}
implementation deps.ms_app_center.analytics
implementation deps.ms_app_center.crashes
implementation deps.viewpager2.viewpager2
implementation deps.contentful.contentful

// Testing
testImplementation deps.testing.junit
testImplementation deps.testing.test_core
testImplementation deps.testing.test_runner
testImplementation deps.testing.test_rules
testImplementation deps.testing.ext_junit
testImplementation deps.testing.mockk
testImplementation deps.testing.mockk_android
testImplementation deps.testing.robolectric
testImplementation deps.testing.espresso_core
testImplementation deps.testing.espresso_intents

}

我也遇到了同样的问题,我想你应该删除build.gradle文件中的“exclude group:'com.google.code.gson”,module:'gson',然后查看项目根目录中的settings.gradle文件并删除该文件….

我也遇到了同样的问题,我想你应该删除“排除build.gradle文件中的组:“com.google.code.gson”,模块:“gson”,然后查看项目根目录中的settings.gradle文件,并删除该文件。…

删除对应于
C/Users/ceddings/StudioProjects/r15 android rms kiosk launcher/kiosk/build/intermediates/mixed_scope_dex_archive/debug/out/1c3715710bef6d11c4bd58c73e056adcb809f2dac72c25d60ee538a9010444f0_1.jar:classes.dex
为我解决了这个问题。

删除与
C/Users/ceddings/StudioProjects/r15 android rms kiosk launcher/kiosk/build/intermediates/mixed_scope_dex_archive/debug/out/1c3715710bef6d11c4bd58c73e056adcb809f2dac72c25d60ee538a9010444f0_1.jar:classes.dex
为我解决了这个问题

dependencies {
implementation project(':sharedcore')
implementation project(':data')
implementation project(':scanner')

implementation deps.kotlin.kotlin_jre
implementation deps.android.app_compat
implementation deps.android.material
implementation deps.android.constraint_layout
implementation deps.logging.timber
implementation deps.retrofit.retrofit
implementation deps.retrofit.retrofit_moshi
implementation deps.moshi.moshi
implementation deps.koin.koin_viewmodel
implementation deps.kotlin.coroutines_core
implementation deps.kotlin.coroutines_android
implementation(deps.auth.adal) {
    exclude group: 'com.android.support', module: 'appcompat-v7'
    exclude group: 'com.google.code.gson', module: 'gson'
}
implementation deps.ms_app_center.analytics
implementation deps.ms_app_center.crashes
implementation deps.viewpager2.viewpager2
implementation deps.contentful.contentful

// Testing
testImplementation deps.testing.junit
testImplementation deps.testing.test_core
testImplementation deps.testing.test_runner
testImplementation deps.testing.test_rules
testImplementation deps.testing.ext_junit
testImplementation deps.testing.mockk
testImplementation deps.testing.mockk_android
testImplementation deps.testing.robolectric
testImplementation deps.testing.espresso_core
testImplementation deps.testing.espresso_intents