Cannot find kotlin.Metadata


#1

Hello,

I’m an Android dev working on my first Kotlin module. My project is a mix of Java and Kotlin modules. Methods in Kotlin module will be called by another Java Module. When I built my project, there was a weird issue of Kotlin.Metadata not found happened when the Java module was built.

[:my Java Module]:compileDebugJavaWithJavac FAILED
/.../build/intermediates/intermediate-jars/debug/classes.jar([my class name].class): warning: Cannot find annotation method 'mv()' in type 'Metadata': class file for kotlin.Metadata not found
/.../build/intermediates/intermediate-jars/debug/classes.jar([my class name].class): warning: Cannot find annotation method 'bv()' in type 'Metadata'
/.../build/intermediates/intermediate-jars/debug/classes.jar([my class name].class): warning: Cannot find annotation method 'k()' in type 'Metadata'
/.../build/intermediates/intermediate-jars/debug/classes.jar([my class name].class): warning: Cannot find annotation method 'd1()' in type 'Metadata'
/.../build/intermediates/intermediate-jars/debug/classes.jar([my class name].class): warning: Cannot find annotation method 'd2()' in type 'Metadata'
error: warnings found and -Werror specified

I think @Metadata{} should be generated for each Kotlin class by Kotlin compiler. However, it seemed that it was not in my project for some reason. I can suppress these warnings to let build continue. But I don’t know whether it will affect the project’s function or not.

Do you guys have any idea about why it happened? I didn’t use proguard.