Poko icon indicating copy to clipboard operation
Poko copied to clipboard

Error when running tests with coverage

Open antonKozyriatskyi opened this issue 3 years ago • 2 comments

When running unit tests with coverage in Android Studio I'm getting the following error dialog:

image

After clicking OK the following error message appears in Build Output tab (though coverage also appears as expected):

	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli(KotlinCoreEnvironment.kt:617)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.registerExtensionsFromPlugins(KotlinCoreEnvironment.kt:130)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:170)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:431)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:226)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:152)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:90)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1500)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.AbstractMethodError: Receiver class dev.drewhamilton.poko.PokoComponentRegistrar does not define or inherit an implementation of the resolved method 'abstract void registerProjectComponents(com.intellij.mock.MockProject, org.jetbrains.kotlin.config.CompilerConfiguration)' of interface org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar.
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli(KotlinCoreEnvironment.kt:609)
	... 28 more


Kotlin: 1.5.10/1.5.21 Poko: 0.8.1 AGP: 4.2.1/4.2.2 Android Studio: Android Studio 4.2.2 - Build #AI-202.7660.26.42.7486908, built on June 24, 2021

antonKozyriatskyi avatar Jul 28 '21 14:07 antonKozyriatskyi

This is from the IDE's built-in coverage tool, right? As opposed to a Jacoco Gradle plugin or something?

What version of the IDE and AGP are you using?

Does the same thing happen with Kotlin 1.5.0 and 1.5.21?

I'm on vacation right now so it's gonna take me awhile to look at this closely.

drewhamilton avatar Jul 28 '21 14:07 drewhamilton

This is from the IDE's built-in coverage tool, right? As opposed to a Jacoco Gradle plugin or something?

Correct. The issue appears only when using built-in coverage tool even if Coverage runner is set to Jacoco.

What version of the IDE and AGP are you using? Does the same thing happen with Kotlin 1.5.0 and 1.5.21?

Both Kotlin 1.5.0 and 1.5.21. Also tried AGP 4.2.1 and 4.2.2. Android Studio v4.2.2 but I remember having this issue in earlier versions too.

I'm on vacation right now so it's gonna take me awhile to look at this closely.

Have a good rest then! This issue is not a blocker for me in any way.

antonKozyriatskyi avatar Jul 28 '21 15:07 antonKozyriatskyi