https://kotlinlang.org logo
j

Jeff Tycz

12/15/2020, 2:30 AM
Hopefully this isn't a silly question but is it possible to for a non-multiplatform Android app to use a multiplatform library? My intention is to have a library that can be used for both non-multiplatform projects and multiplatform projects. Is this even possible?
a

Andrew

12/15/2020, 4:36 AM
Not sure what you mean on the last part of your question. But a multiplatform library produces outputs on each target you specify, if one is Java then Android can use it just like any other Java library.
k

Kurt Renzo Acosta

12/15/2020, 4:39 AM
Definitely. My setup is heavily modularized so i have a shared multiplatform modules and platform specific modules. Some multiplatform modules use other multiplatform modules which are also used by the platform specific modules as needed.
👍 1
m

mbonnin

12/15/2020, 8:18 AM
That works well except IDE support has been very flaky in my experience if both the multiplatform lib and Android app are in the same project. I've seen cases where symbols where not resolved
true story 1
k

Kurt Renzo Acosta

12/15/2020, 8:19 AM
I’ve never experienced issues on my end though. I’ve been having the same setup for over a year
m

mbonnin

12/15/2020, 9:14 AM
Is your project open source by any chance @Kurt Renzo Acosta ? Maybe there's something we're doing that confuses IntelliJ
k

Kurt Renzo Acosta

12/15/2020, 9:19 AM
sadly, no. as much as i’d love to share them, they’re proprietary projects. i’ve seen in your reproducer and i might’ve misunderstood the problem. my setup is multiplatform modules consuming other own multiplatform modules and platform specific modules consuming other multiplatform modules. it works in Android and iOS but I haven’t tried it with a JVM
m

mbonnin

12/15/2020, 9:24 AM
I've had some success consuming
android
multiplatform targets from a non-multiplatform Android app module in https://github.com/HearthSim/Arcane-Tracker. But looks like it doesn't work when consuming
jvm
multiplatform targets
2 Views