Alireza Ahmadi
Alireza Ahmadi

Reputation: 5338

java.lang.IllegalArgumentException: @kotlin.Metadata does not define an element error when converting code from Java to Kotlin

I'm trying to convert one class file in one of our modules in our application from java to Kotlin but I get this error message when trying to build.

The line that causes this error is using dagger @Inject removing @Inject will make the error go away.

* What went wrong:
Execution failed for task 'processX86DebugAnnotationsWithJavac'.
> java.lang.IllegalArgumentException: @kotlin.Metadata does not define an element k()

Our main module that uses this module is written completely in Java and has no Kotlin related code in it.

Any suggestions?

Upvotes: 0

Views: 1335

Answers (1)

Alireza Ahmadi
Alireza Ahmadi

Reputation: 5338

Solved! I was adding Kotlin standard library to the the module that uses the Kotlin but not in the module that was using this module. Adding the library to the main module as well solved the issue.

Upvotes: 1

Related Questions