https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

Sylvain Patenaude

10/31/2019, 8:47 PM
When targeting Android, is it preferred to use 'jvm' or 'android' as a target? From what I've read, 'jvm' seems to do the job, so any need to go native with the 'Android' target?
d

Daniel Rampelt

10/31/2019, 8:49 PM
it depends if you need to access the android APIs in your multiplatform module or not, if you don't need them then
jvm
would probably be preferred
pure
jvm
modules should compile faster since they don't have to do any of the android specific build process
s

Sylvain Patenaude

10/31/2019, 8:55 PM
That's a good question. In phase 1 of my SDK, most if not all code will be common and consumed by potential clients (Android, iOS or even cross-platform (Xamarin, React Native, etc.)). However, there might be a phase 2 where some specific Android/iOS BLE implementations would be needed. So I guess that I would need to go the
android
way from the start to avoid a big refactoring?
k

Kris Wong

10/31/2019, 9:13 PM
it will be the same cost whether you do it now or later
d

Daniel Rampelt

10/31/2019, 9:21 PM
yeah it shouldn't be much work to switch it later
s

Sylvain Patenaude

10/31/2019, 9:33 PM
Ok in that case I might start targeting
jvm
for the Android consumers of my SDK.
4 Views