Error on Unit tests with [initializationError]

Hi Everyone,

I am having this error with my project that I desperately need help with.
Every time I run this command on Android Studio Terminal ./gradlew test it ends up with the following error:

Task :app:testUsProductionUnitTest FAILED > initializationError FAILED
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.IllegalAccessError

1 test completed, 1 failed
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions

FAILURE: Build failed with an exception.

My project is an Android Project with Native Java and Kotlin. None in my team are encountering this issue. My Development environment is:

Gradle 5.4.1

Build time: 2019-04-26 08:14:42 UTC
Revision: 261d171646b36a6a28d5a19a69676cd098a4c19d

Kotlin: 1.3.21
Groovy: 2.5.4
Ant: Apache Ant™ version 1.9.13 compiled on July 10 2018
JVM: 10.0.2 (“Oracle Corporation” 10.0.2+13)
OS: Mac OS X 10.15.3 x86_64

Java Version:
java 10.0.2 2018-07-17
Java™ SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot™ 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

I have tried with java 13 as well.

Here are some more details on the issue:

Please let me know what I am doing wrong here.

Thank you

Solved the problem with the help of my teammates.

Apparently it was a JDK issue. I had to downgrade my JDK to version 8.

1 Like