【发布时间】:2020-07-16 05:48:30
【问题描述】:
当我尝试向我的应用程序的 gradle 文件中添加 Contentful 的实现时遇到此错误
Type com.google.gson.ExclusionStrategy is defined multiple times
看起来我的中间 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
}
【问题讨论】:
标签: android gradle build build.gradle contentful