https://kotlinlang.org logo
#library-development
Title
# library-development
m

martinsumera

05/19/2020, 1:52 PM
I’m having an issue with creating a library for Android. When I add the library as a dependency then I’m not able to resolve top-level kotlin function. It looks like these functions are not even there, but I can see that they are there and I can even use them within java but not within kotlin. https://youtrack.jetbrains.com/issue/KT-38917 I have created an issue there but so far I didn’t get any response. I think that it is caused by missing some metadata but I’m not able to find which one. Can somebody help me with this issue?
l

louiscad

05/19/2020, 5:17 PM
@martinsumera Can you put your sample project on GitHub so we can peek at its configuration?
g

gildor

05/20/2020, 4:09 AM
I’m not able to resolve top-level kotlin function.
Looks that @Metadata is removed, do you use R8/Proguard?
m

martinsumera

05/20/2020, 2:29 PM
It was caused by missing `
Copy code
/META-INF/*.kotlin_module
I was able to solve it by adding this to packagingOptions https://stackoverflow.com/questions/61892974/im-not-able-to-use-top-level-functions-from-my-custom-kotlin-library
g

gildor

05/20/2020, 4:00 PM
wow, so it’s AGP 4.1 bug
thanks for pointing this out
l

louiscad

05/20/2020, 9:28 PM
Fixed in AGP 4.1.0-alpha10, which I'm eagerly waiting for!
4 Views