0

After updating Kotlin version from 1.2.51 to 1.3.11 I have a compilation error (kaptGenerateStubsDebugKotlin FAILED).

e: java.lang.NoSuchFieldError: CONTENT_ROOTS
 at org.jetbrains.kotlin.kapt3.Kapt3ComponentRegistrar.registerProjectComponents(Kapt3Plugin.kt:296)
 at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:179)
 at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:117)
 at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:413)
 at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:276)
 at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:154)
 at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63)
 at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:108)
 at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:52)
 at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
 at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:395)
 at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:97)
 at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:909)
 at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
 at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
 at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:939)
 at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:908)
 at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:394)
 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
 at sun.rmi.transport.Transport$1.run(Transport.java:200)
 at sun.rmi.transport.Transport$1.run(Transport.java:197)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
 at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at java.lang.Thread.run(Thread.java:745)

I have also tried the latest versions (newer than 1.2.51) but I have the same problem.

Humak
  • 1
  • Have you tried cleaning the build cache? – Logain Jan 07 '19 at 19:08
  • Yes, I tried cleaning the cache, build cache, grade cache. I have used “invalidate cache and restart” and etc. I can see a message “Internal compiler error”. I observe this problem only on kotlin versions newer than 1.2.51. – Humak Jan 07 '19 at 21:36
  • I have looked kapt source codes and I don’t really understand why there is an error in this place in code. – Humak Jan 07 '19 at 21:41
  • Can you share your gradle file? Maybe you have some conflicts with other libraries/plugins. Also, just in case, make sure you have the latest version of the kotlin plugin for android studio. – Logain Jan 07 '19 at 21:45

0 Answers0