Structuring Modular Android Kotlin Multiplatform projects - IntelliJ IDEA

I just used IntelliJ to create a Kotlin (Mobile Android/iOS) project.

The outcome of using IntelliJ is a coupled shared project and Android app

The Android UI code lives in some main folder

I’m wondering why IDEA doesn’t do this on a more modular level. So something like this:

  • Separate Android Module
  • Separate Shared Module

So basically the android module uses the shared one and the shared one is also compiled into the framework for iOS.

Has anyone successfully structured their project like this with correct test configurations as wel?

Have a look at: https://github.com/pdvrieze/xmlutil I have some common tests. Note that the common test module itself cannot be “ran”. Tests always need to run on an actual platform, but can be shared (automatically) across all platforms. (make sure to set dependencies across the test source sets). In addition my configuration also has a common source set between jdk and android targets (they are different because Android has a different xml library).