Kaspresso
Kaspresso copied to clipboard
Resolve Error while merging dex archives "DexArchiveMergerException"
When I run instrumentation tests from terminal using ./gradlew clean app:connectedDebugAndroidTest
using Kaspresso
dependency, Gradle shows me an error:
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
> There was a failure while executing work items
> A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Type android.support.v4.app.INotificationSideChannel is defined multiple times: /Users/myuser/.gradle/caches/transforms-2/files-2.1/5e95fa91c034537d18b6430f6cfedd80/core-1.5.0-runtime/classes.dex, /Users/myuser/.gradle/caches/transforms-2/files-2.1/beb8b83d149d5121f4df541f456092a8/core-1.5.0-runtime/classes.dex
To fix the issue you need to exclude androidx.core:core
transitive dependency from androidTest "com.kaspersky.android-components:kaspresso:${Versions.kaspresso}"
:
dependencies {
// ...
androidTestImplementation("com.kaspersky.android-components:kaspresso:${Versions.kaspresso}") {
exclude group: "androidx.core", module: "core"
}
}
@ultraon thank you for your research! @RuslanMingaliev please keep in mind
@ultraon which Gradle version do you use in your project?
Gradle - 6.7.1, Android Gradle Plugin - 4.2.1
It is worth to mention, without the fix https://github.com/KasperskyLab/Kaspresso/issues/258#issuecomment-856173894 it is built successfully, but need to run the same cmd 2nd time ./gradlew app:connectedDebugAndroidTest
(but without clean
).
Faced a similar problem when upgrading from 1.3 to 1.4 Gradle - 6.5 \ Android Gradle Plugin - 4.1.3
~~any idea how to fix this problem? (excluding fix from #258 (comment) )~~ UPD: helped change compileSdkVersion 30 to 31
Hi, @ultraon! I've tried to reproduce your issue on sample project with Kaspresso 1.4.2 and explicit androidx.core dependency, but unfortunately with no luck.
Kaspresso 1.4.2 uses androidx.core 1.9.0 which requires compileSdk 33. Please:
- Update your Kaspresso version to 1.4.2
- Bump your compileSdk to 33
- Remove explicit dependency on androidx.core if you don't really need specific version
- Use exclude expression otherwise Also I'd suggest you to use newer gradle and AGP.
Unfortunately, none of these steps could be done on Kaspresso side so we're leaning to closing this issue. Please tell us if you need any further help
Please, re-open if you went through steps above and still experience this issue