java.lang.NoClassDefFoundError: kotlin/test/AssertionsKt Error
See original GitHub issueI have just added testImplementation ‘org.amshove.kluent:kluent-android:1.45’ to my Android project and when I run a simple test like this:
@Test
fun `this should be true`() {
true.shouldBeTrue()
}
the following error is thrown:
`java.lang.NoClassDefFoundError: kotlin/test/AssertionsKt
at org.amshove.kluent.internal.AssertionsKt.assertTrue(Assertions.kt:7)
at org.amshove.kluent.BasicKt.shouldBeTrue(Basic.kt:35)
at ro.fortech.mindclub.validators.SimpleTest.this should be true(SimpleTest.kt:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.ClassNotFoundException: kotlin.test.AssertionsKt
Issue Analytics
- State:
- Created 5 years ago
- Comments:38 (24 by maintainers)
Top Results From Across the Web
NoClassDefFoundError thrown during runtime on Kotest Unit ...
I'm getting this NoClassDefFoundError during run time (Run test via Intellij or via gradlew test ). Here is my simple test (new to...
Read more >NCDFE “kotlin/test/AssertionsKt” on running tests from gutter ...
Open FooTest and run the test from gutter. You will get the exception: java.lang.NoClassDefFoundError: kotlin/test/AssertionsKt at org.amshove.kluent.
Read more >Noclassdeffounderror While Trying To Run Unit Tests On ...
Have a Android project run junit test fine suddenly it failed to run unit test with following error: xxxxTest initializationError java.lang. What is...
Read more >NoClassDefFoundError on Kotlin class in JUnit test at runtime
My Kotlin class compiles and runs on an emulator without a problem. But when I test it, Android Studio says the class is...
Read more >The java.lang.NoClassDefFoundError in JUnit - Baeldung
2. What Is java.lang.NoClassDefFoundError? · Missing a few dependent jars which is the most common reason. · All jars are added as dependencies ......
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 Free
Top 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

@MarkusAmshove,
testImplementation 'org.amshove.kluent:kluent-android:1.48'is working (without needingorg.jetbrains.kotlin:kotlin-test:$kotlin_version)!!!Running the tests via AS and command line both work for me 🎉.
Have you added
org.jetbrains.kotlin:kotlin-test:$kotlin_versionastestImplementation?