Justin Xu
10/12/2022, 2:59 AMThe 'java' plugin has been applied, but it is not compatible with the Android plugins.
. Is there a better way to have a single client/server app in kmm mobile?Vitor Hugo Schwaab
10/12/2022, 6:34 AM-projectRoot
|-shared
|-commonMain
|-jvmMain
|-androidMain
|-iOSMain
|-server
|-androidApp
|-iOSApp
shared
would have all the code that can be shared across platforms.
server
is a JVM / Ktor server module just like the one you had in a different repository. It depends on shared
to get shared code
androidApp
is a pure Android app, with shared
as a dependency
iOSApp
is a pure iOS app, with shared
as a dependencyMustafa Ozhan
10/12/2022, 8:31 AMandroid
ios
and backend
the module common
is used all 3 targets
while module client
is only for mobile
you can find example of ktor usage in common
module: https://github.com/Oztechan/CCCJustin Xu
10/12/2022, 9:32 PMVitor Hugo Schwaab
10/13/2022, 3:31 AMJustin Xu
10/13/2022, 10:25 PMVitor Hugo Schwaab
10/14/2022, 6:01 AMshared
module, the only thing it contains are the serialization models, so both Server and Clients can use it.
The server
module defines how the API works, and it uses uses the models in shared
to serialize results.
The shared-clients
module consumes the API and uses the models in shared
to parse what the server responds.
android and JS clients use the shared-clients
to have the same logic when it comes to consuming the API