Duplicate class io.mockk.ValueClassSupportKt
See original GitHub issue- I am running the latest version
- I checked the documentation and found no answer
- I checked to make sure that this issue has not already been filed
Expected Behavior
Trying to launch android instrumented test with my android compose project using cucumber + mockk
Current Behavior
When launching my test, i got this error stacktrace :
Execution failed for task ':app:checkDebugAndroidTestDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class io.mockk.ValueClassSupportKt found in modules jetified-mockk-agent-android-1.12.4-runtime (io.mockk:mockk-agent-android:1.12.4) and jetified-mockk-agent-jvm-1.12.4 (io.mockk:mockk-agent-jvm:1.12.4)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
Steps to Reproduce
Add in build.gradle.kts (or build.gradle equivalent)
androidTestImplementation("io.mockk:mockk-android:1.12.4")
androidTestImplementation("io.mockk:mockk-agent-jvm:1.12.4")
Launch Android Instrumented Test
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
- MockK version: 1.12.4
- OS: Android
- Kotlin version: 1.6.21
- JDK version: 11
- Type of test: Android instrumented test
Stack trace
Execution failed for task ':app:checkDebugAndroidTestDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class io.mockk.ValueClassSupportKt found in modules jetified-mockk-agent-android-1.12.4-runtime (io.mockk:mockk-agent-android:1.12.4) and jetified-mockk-agent-jvm-1.12.4 (io.mockk:mockk-agent-jvm:1.12.4)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
I have found this topic who was talking about : https://github.com/mockk/mockk/issues/722
But the solution was to remove mockk-agent-jvm (by excluding or not) If i exclude (or remove it), i get this error :
Caused by: io.mockk.proxy.MockKAgentException: MockK could not self-attach a jvmti agent to the current VM. This feature is required for inline mocking.
This error occured due to an I/O error during the creation of this agent: java.io.IOException: Unable to dlopen libmockkjvmtiagent.so: dlopen failed: library "libmockkjvmtiagent.so" not found
Potentially, the current VM does not support the jvmti API correctly
at io.mockk.proxy.android.AndroidMockKAgentFactory.init(AndroidMockKAgentFactory.kt:67)
at io.mockk.impl.JvmMockKGateway.<init>(JvmMockKGateway.kt:46)
at io.mockk.impl.JvmMockKGateway.<clinit>(JvmMockKGateway.kt:186)
... 42 more
Caused by: java.io.IOException: Unable to dlopen libmockkjvmtiagent.so: dlopen failed: library "libmockkjvmtiagent.so" not found
at dalvik.system.VMDebug.nativeAttachAgent(Native Method)
at dalvik.system.VMDebug.attachAgent(VMDebug.java:572)
at android.os.Debug.attachJvmtiAgent(Debug.java:2563)
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:9
Top Results From Across the Web
"Duplicate class io.mockk.ValueClassSupportKt found" when ...
Android instrumented tests fail with Duplicate class io.mockk.ValueClassSupportKt found compilation error (see stack trace below).
Read more >Duplicate class Testable found in modules junit-platform ...
Hi I'm new in Android and I'm trying to run some test. But when I try to use kotlintest I get the following...
Read more >"Duplicate class .. found in modules ..." triggered ... - YouTrack
I am using the kotlin lets plot api, which works 100% on jupyter and in standalone apps,. however I'm trying to use it...
Read more >Duplicate class io.mockk.ValueClassSupportKt #828 - bytemeta
Duplicate class io.mockk.ValueClassSupportKt #828. I am running the latest version; I checked the documentation and found no answer; I checked to make sure...
Read more >mocking library for Kotlin - AndroidRepo
androidTestImplementation "io.mockk:mockk-android:{version}" ... class TrafficSystem { lateinit var car1: Car lateinit var car2: Car ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I tried the same solution from @jknair0 to remove the
androidTestImplementation "io.mockk:mockk-android:$mockk_version"
now the instrumentation tests run, thanks for that! but the tests I have use Mocck lib functionevery
and now the import doesn’t workimport io.mocck.every
. How can I import functions from Mocck now? is there a way to do some valid import now that it comes fromagent-android
?This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are sure that this issue is important and should not be marked as
stale
just ask to put animportant
label.