Is it possible to build stuff for androidTV and wearOS with kotlin multiplatform?
b
Is it possible to build stuff for androidTV and wearOS with kotlin multiplatform?
🙂 1
j
wearOS for sure, there are targets. For AndroidTV I have no idea, but probably yes
b
There's wearOS target?? Thought there's only watchOS
j
Sorry, I read watchOS
My bad, then I am not sure, probably you have to create mĂșltiple android targets
Is it not the same that an Android app? I mean, you just create the standalone app with no kmp
or you are trying to share a wearOS lib?
b
Just experimenting, really. Think of it as a lib
I think they are just normal app/library modules, so you can just create a normal android target
t
Works fine, I am using multiplatform modules for both Wear OS and Android TV. They are just Android devices which need a different UI.
b
How do you declare them in kotlin targets block? Or can you just repeat android() target?
t
You can just use the same android() target as you probably would like to share the same code
b
How do you implement two different UIs in the same target, then?
t
Then create multiple standard Android modules, one for mobile, one for wear os, one for TV, which all depend on the multiplatform one.
b
Ah, got it
t
Put the UI code in there
b
Was expecting something more uniform
I hate that android is a "special snowflake" and breaks usual MPP layout...
➕ 2
t
Well this is how I am doing it which is working great. I tried sharing UI but that is just not really useful as the devices are so different. You could share some custom views and resources by putting them in the shared module, but that's it.
Maybe you could use Android flavors in the shared module, one for mobile, wear, and tv. But I am not sure how good that will work.