I'm struggling with my first project on KMP. I cre...
# multiplatform
a
I'm struggling with my first project on KMP. I creat a project simple from KMP plugin in IntilijIdea. Creating all the necessary module for me: Android, Desktop and web. After trying hard I succeeded in making Desktop and Web part compile The problem is with Android part it doesn't compile. And finally I created KMM project using Android Studio It works correctly but I failed to add it with the desktop and web project What I have to do ?! Is there any willing from Jetbrain team to improve the user experience with the plugin and the default project sample ?! 😢 ... By the way, I'm just a student have prior knowledge with Android (Kotlin/Java) But I have to make a website and Android App to my school So I think Kotlin multiplatform is the best choice as I master Kotlin ... So I'm asking if any one can help me in the gradle files And also if my choice of KMP is right ?! Or I have to pick another technology like Flutter/ React native instead
b
Android is a special snoflake in kmp. Best move it to an isolated module that in itself depends on kmp module
This way android stuff is the same as for any other app and your kmp bit becomes just a local lib for it
a
@Big Chungus Now I have two project One for Android And one for Desktop and Web ... What are the steps to do to integrate Android with them ?! I mean I want to use shared module to write one logic
b
Create kmp module and declare jvm and js targets (you can depend on jvm jars from android app). If android complains, try adding android target to kmp module too.
❤️ 1
Then just add it to app module dependencies via implementation(project (":my-kmp-module"))
❤️ 1
a
I will try last chance Thank you @Big Chungus I really appreciate your help
b
PM me if you get stuck. Happy to hop on screen share to sort you out.
❤️ 1
Also full disclaimer - I'm an android noob 😀
k
So, I had a real hard time when I first started too. I found that the KMM plugin in Intellij didn’t work for me. I had to use the one in Android Studio (Canary).