Yesterday I imported both my old android project a...
# multiplatform
c
Yesterday I imported both my old android project and iOS to my new KMM projetect ❤️. But honestly the current public documentation is not good. If I didn't had some medium posts to help me out I would have failed, or taken way longer. If you would do this migration into KMM, which sources do you use? Do you know the process back and forth? Am I too green? I would like to hear other people experiences. I feel like there is still space for a good guide for it, with a video and all, I'm probably gonna put my hands on 🙃
a
Do you remember, which pieces you lacked the most in docs and which medium posts you've used? We're trying to improve onboarding experience right now and your feedback would be really useful!
👌 3
c
This is my note about importing iOS project: We should add this scripts into projectName -> Build phases -> + -> new run script phase -> drag it to the top so it runs first and add this script: cd “$SRCROOT/..” ./gradlew commonpackForXCode -PXCODE_CONFIGURATION=${CONFIGURATION} This tutorial is a good place to follow: https://medium.com/better-programming/migrating-an-existing-xcode-project-to-a-new-kotlin-multiplatform-mobile-app-b71d07f23b7a But his run script is wrong also in Build Settings you just need to add this to the header (not the detail with Debug and Release): $(SRCROOT)/../common/build/xcode-frameworks Where common is the name of your shared library And this is my note about android: This is important because it shows how to import an existing Android Project It was pretty complicated so I believe the best this to do would be to compare with the legacy projects gradle Useful links that helped this implementation: https://medium.com/icerock/how-to-start-use-kotlin-multiplatform-for-mobile-development-1d3022742178 Honestly just for reference because I needed to basically look how it was in a freshly created wizard KMM project to see what was where. Weirdly enough: Android was the worst port, so what I did was basically creating a new project and mimicking what was happening there. I also never had worked with kotlin graddle (.kts) before and this was another one that I couldn’t find easy answers until I understood how the implementation works. If we had a: Chop this scripts off your main project, move them here, now add this to common and boom it’s working. After I finished, I felt like something similar could exist and what I found was this: https://kotlinlang.org/docs/mobile/integrate-in-existing-app.html , which honestly I’m too stupid to understand. The available information on the kotlinlang just get you so far. This tutorials where very helpful: https://play.kotlinlang.org/hands-on/overview , mainly when I wanted to implement Ktor on my common The official talks I found speak about what it can do and architecture, which is nice (now I know a lot of it), but nothing official really shows you the stupid stuff.
🔥 3
🙌 3
It took me 9 hours to merge both iOS and Android into my new KMM project, which I think it’s not this bad but, I know it could be a 15 minute process.
true story 1
a
Thanks a lot for the feedback, it’ll be really useful! Yes, the article about integrating into existing app for now is more conceptual, than practical, but we’re working on it.
💪🏽 1
g
I will give my 5 cents to this topic. A few days ago I finished KMP for
Android
,
iOS
and
JS-react
. To make support for
Android
and
iOS
was not so difficult as there is good official documentation how to support both mobile platforms. But then, when I wanted to add
JS-react
target as a third target I got difficulties as there is no official documentation how to support those 3 targets simultaneously in one project. Guys from this channel helped me with this task by sharing a few GitHub sample projects - I checked them and completed my project. But if there would be official documentation(like there's for
Android/iOS
targets) how to support
Android/iOS/JS
that part might be easier/faster for newcomer in KMP. Btw, current official series of hands-on labs written in clear manner and there is no need to search or read additionally to understand basic concepts.
🙌 3
👍 3
a
Would you like to share the samples you’ve used, if you liked them? We have a little “wall of fame” for samples in docs, would love to add new items to that 🙂
c
@German Politov now I want those links because my next task is to add a JS target 🙂
g
@akapanina @Cicero sure here is the link to that thread with sample projects: https://kotlinlang.slack.com/archives/C3PQML5NU/p1605618178066300?thread_ts=1605618076.066200&cid=C3PQML5NU I see that Android/iOS/JS targets in KMP can be popular not only for me ;)
💪🏽 2
a
Ah, what would we do without @John O'Reilly 🙂
👍 2
🌈 2
j
What I struggled with the most, coming from the iOS world, was the Gradle files using Kotlin Script. I had a lot of issues with conflicting dependencies and with understanding the file itself. Most of the tutorials I found used older versions of dependencies, so I had to update some and then ran into other conflicts, setting target JVM versions, they also used Groovy syntax and it took a bit of time to learn how to translate some things into KTS
🙌 4
a
To all folks with iOS background, who come to Multiplatform and are dealing with Gradle for the first time: you’re literally our heroes. And thanks for the feedback, @Jeremias Nunez, it’s very valuable - we’ve just started discussing what are the most Gradle experience parts for our users.
❤️ 2