Search code examples
kotlin-multiplatform

How to import Google's libphonenumber library into KMP common"


I would like to import [libphonenumber] into the 'common' part of a KMP project, but Kotlin can't import it. I see the library added twice to the external libraries after I added the maven url. But, the import in Kotlin can't resolve the library, so I can't use the libraries classes. What am I missing?


Solution

  • libphonenumber isn't a Kotlin Multiplatform library. It seems to support many platforms, so you could write library wrappers for Kotlin.

    I gave a talk about writing platform wrapper libraries: https://vimeo.com/371460823

    If the target for native is C++, you'll likely need to write some C wrappers. Just FYI.