Has anyone tried adding Jetpack Compose to existing KMM project. As soon I add the required dependencies for compose in the project gradle file, it just does not work. I am on Android Studio 4.2 C 12. Tried to copy the settings from perfectly working Compose examples, still no luck
09/23/2020, 8:25 PM
Are you trying to add compose code to same module that you have KMM shared code in? If so, then I believe there's still some issues with that
09/23/2020, 9:14 PM
No, what I am trying to achieve is to have a KMM enabled project and I want to use compose to build the Android app. I am adding compose dependency in app build gradle file, not in shared module gradle file.
@Ajeet Pratap I did try and it had a compiler issue (probably the compose compiler and the kmm setup don't work together). At the time there was no solution and there is a bug open https://youtrack.jetbrains.com/issue/KT-38694 but as I see now (in a comment) there might be a workaround: https://github.com/avdim/compose_mpp_workaround
If this doesn't work, then make your KMM project as an Android library (that is what I did and that is also what decompose does as I see) and just have an Android module that depends on that and has the compose plugin installed
09/24/2020, 8:17 AM
@Ajeet Pratap if it is case that compose usage will be in say your app module and KMM is in a separate shared module then there's a few samples around that do that.....I have following one for example if you want to use to compare config etc https://github.com/joreilly/PeopleInSpace
09/24/2020, 11:24 AM
Yes, this MPP workaround does work. It allows one to use Compose in the androidMain source set.