How to Migrate an Android Project to Kotlin Multiplatform (KMP)

Sdílet
Vložit
  • čas přidán 11. 07. 2024
  • In this video, you'll learn how you can take an existing native Android project in Android Studio and migrate it to Kotlin Multiplatform, so you can use the app on iOS as well.
    🏴🏴🏴 PL CODING BLACK WEEK - Save up to 50% on ALL premium courses and bundles:
    pl-coding.com/premium-courses...
    💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:
    pl-coding.com/drop-table-ment...
    Get my FREE PDF about 20 things you should never do in Jetpack Compose:
    pl-coding.com/jetpack-compose...
    Regular programming advice on my Instagram page:
    / _philipplackner_
    Join my Discord server:
    / discord
    Kotlin Multiplatform iOS setup guide:
    www.jetbrains.com/help/kotlin...
    Kotlin Multiplatform is stable - blog article from JetBrains:
    blog.jetbrains.com/kotlin/202...

Komentáře • 67

  • @khanzadakashif8248
    @khanzadakashif8248 Před 7 měsíci +31

    It was a good tutorial, but it would be better if you now create one in which you migrate this project to share the UI as well with compose multiplatform.

  • @jamesdavenavor6247
    @jamesdavenavor6247 Před 7 měsíci +1

    Thanks a lot Philipp
    I was already trying to figure out how to do it but you just went and gave an answer

  • @atglira
    @atglira Před 2 měsíci

    My hero! thank you very much! amazing job Mr. Lackner

  • @MobileMastersAndroidiOS
    @MobileMastersAndroidiOS Před 7 měsíci

    Great job Philipp!

  • @daniyar2718
    @daniyar2718 Před měsícem

    thanks for this video

  • @mahmoudalkateb2008
    @mahmoudalkateb2008 Před 7 měsíci

    LETS GOOOO 🎉

  • @SamandarSdk
    @SamandarSdk Před 7 měsíci +1

    Nice video Philipp. Have u tried Fleet ide?

  • @kesavguru415
    @kesavguru415 Před 7 měsíci

    Nice live Philipp 🎉😊

  • @OlegsSimRacing
    @OlegsSimRacing Před 2 dny

    If you don't see option of creating a KMP module, you need to turn on experimental settings:
    In Android Studio settings, turn on the Enable experimental Multiplatform IDE features option in the Advanced Settings section.

  • @ranjanrukhaya3025
    @ranjanrukhaya3025 Před 7 měsíci

    Great work @philipp lackner Just wandering how we can do it for android library. Can we have a tutorial on this, that would be really helpful. Thx

  • @JacobFerrero
    @JacobFerrero Před 7 měsíci +1

    Hey Philipp, do you have any tutorials on how to dynammically load KMP modules, specifically for Web projects? I want to reduce the size of my initial download every visitor needs to download.

  • @samer616
    @samer616 Před 7 měsíci

    Hey Philipp, does the premium course use a multi modular architecture?
    I have a multi modular project using CLEAN on Android and would like to migrate to use KMP for the new iOS project.

  • @vikashparajuli
    @vikashparajuli Před 7 měsíci +2

    Cheers for the tutorial.
    In the real project, there will be lots of work on the migration. Most of the libraries (written in java) that we use on the native android app doesn't work on KMP. This needs to be replaced with the KMP support libraries.

  • @Wallenlaguinee
    @Wallenlaguinee Před 7 měsíci +1

    Wow, Flutter dependency configuration is so much easier. "flutter pub get [your desired package]".
    But thanks for an informative tutorial as usual!

  • @user-ec8rq3uu5r
    @user-ec8rq3uu5r Před 7 měsíci +2

    Hi Philipp, I have a question and hope you will answer it for me.
    We interact between view and viewmodel using state variable and onEvent function written in viewmodel. Because all states are written into State data class (Ex: HomeState), when there is an event such as click the button or enter text in textfield, onEvent function will be called. This will result in the state variable being assigned a new value, and all views related to this state variable in the Screen will be recomposed. This is something we do not want to happen. Can you give me some solution to fix this?
    Thank you so much... ❤

  • @asifmehmood9307
    @asifmehmood9307 Před 7 měsíci +2

    Great job @philipp lackner I have one question from kotlin DSL or version catalog which one is better than for handling dependencies?

    • @sudarshanbhatt9435
      @sudarshanbhatt9435 Před 7 měsíci

      both are independent things. but you can use version catalog, its pretty handy and easy to use

  • @vendrieyulman2917
    @vendrieyulman2917 Před 7 měsíci +1

    please make a tutorial video about how to configure dekstop, ios android KMM.

  • @nomejodas2978
    @nomejodas2978 Před 7 měsíci +2

    Philipp, do you think it would be wise to do all the Domain and Data layer using KMM and the presentation later using Flutter?

  • @tutrieu3250
    @tutrieu3250 Před 7 měsíci +1

    I have a question.if I use window.Can I run KMP without plugin xcode ios right?😢😢

  • @arozendojr
    @arozendojr Před 7 měsíci

    I got an old MacBook that runs iOS simulator, is it possible to run xcode on my M1 and run iOS app on the old MacBook?

  • @mohanaggarwal4058
    @mohanaggarwal4058 Před 6 měsíci

    Please make a tutorial to make desktop app from existing Android app project

  • @soc3xp
    @soc3xp Před 7 měsíci

    KMM 🎉

  • @arozendojr
    @arozendojr Před 7 měsíci +1

    Can you make GitHub available, commit before and after migration, please

  • @moonlightstudio
    @moonlightstudio Před 6 měsíci

    I ask for a tutorial on how to migrate the JVM library to Kotlin multiplatfrom?

  • @abacaabaca8131
    @abacaabaca8131 Před 7 měsíci +1

    I must say i never understand gradle but currently i am learning libgdx because i was suprised kotlin can be used and run the .apk on android. And its working. Maybe later i will try this (compile into apple).

    • @ChrisAthanas
      @ChrisAthanas Před 7 měsíci +1

      Is that a 2d engine?

    • @ChrisAthanas
      @ChrisAthanas Před 7 měsíci +2

      Gradle sucks and it’s a required pain point for android dev

    • @astaghfirullahalzimastaghf3648
      @astaghfirullahalzimastaghf3648 Před 7 měsíci

      @@ChrisAthanas i was able to follow a tutorial from gamefromscratch youtube channel and render a 3d model with animation in my android phone. But it uses JSON library if not mistaken to parse the .g3db (the binary format) of the model's object file . If you want it to parse its respective text format which is .g3dj it can do it as well. But currently, i want to figure out how to configure the camera for controlling the model's movement.

  • @swish6143
    @swish6143 Před 6 měsíci +2

    I don't get the sharedModule option in 4:10 although I have the KMP Plugin installed. I can also create a new KMP Project.

    • @jeremymacnicol6023
      @jeremymacnicol6023 Před 5 měsíci

      I'm having the same problem. I'm using Android Studio Hedgehog if that means anything.
      Ultimately, I copied the "shared" module from the second project and pasted into the original. Hopefully that works.

    • @marcelbreas3544
      @marcelbreas3544 Před 4 měsíci +7

      That’s because of the earlier version of the KMP plugin used in the video. I believe this feature was later marked as experimental and in doing so was removed from being shown. You can enable it by going into Android Studio settings and search for ‘kotlin’ under Advanded Settings. A search result ‘Enable experimental Multiplatform IDE features’ should pop up. Enable it, hit apply and restart Android Studio. The option should now show up when you try to create a new module.

    • @Desuzedart
      @Desuzedart Před 4 měsíci

      @@marcelbreas3544 thank u guys, i faced the same problem. Ur workaround resolved the problem! Best wishes

    • @Kmg403
      @Kmg403 Před 3 měsíci

      @@marcelbreas3544 thank you, this worked.

    • @superkobke
      @superkobke Před 2 měsíci

      @@marcelbreas3544 Thanks, making the video is easy but answering questions, apparently not

  • @argahutama
    @argahutama Před 7 měsíci +3

    Hi Philipp,
    Can we modularize KMP app? For instance, separate the layer of data-domain-presentation?

    • @ChrisAthanas
      @ChrisAthanas Před 7 měsíci +2

      Yes not a problem for kmp

    • @arsildo
      @arsildo Před 7 měsíci

      I have been banging my head over this, while you can you have to manage ios frameworks which so far i have had no luck or the skill to perform. At first I went in with the idea of creating my featureA module and have for example featureA ui in Compose and featureA with swiftUi in ios and the common code between them and then import that featureA to the main module, but no that doesn't work or i haven't managed to do it yet, or don't even know if it is possible at this point

    • @arsildo
      @arsildo Před 7 měsíci +2

      a video on this would be great @PhilippLackner

    • @moldovanpeter5123
      @moldovanpeter5123 Před 7 měsíci

      There is the KMM course from Philipp where he covers this in details. I am suggesting also to read some articles and case studies to broaden your knowledge 😊. Ex. Touchlab.

  • @abdelrahmankhaled7575
    @abdelrahmankhaled7575 Před 7 měsíci +2

    Can we use the new editor Fleet IDE to write the ios code on a windows pc instead of mac xCode IDE ?

    • @ChrisAthanas
      @ChrisAthanas Před 7 měsíci +2

      Likely true but the standard for android will be android studio for next couple years

    • @arsildo
      @arsildo Před 7 měsíci

      No to write and test ios apps you need a mac

  • @user-wc2zr7kk2s
    @user-wc2zr7kk2s Před 6 měsíci

    Getting 'Failed building KotlinMPPGradleModel" error how to solved it.

  • @theren8311
    @theren8311 Před 3 měsíci

    IDK man, I appreciate the video, but it's no different from the docs, and you easily consume the docs better. Or maybe it's just me, because if I watched this first I would have to rewatch scenes over because of all the zipping around. But looking at the comments, I guess everyone has their preference. I was hoping watching this I would get something more.

  • @zaidkamil
    @zaidkamil Před 7 měsíci +2

    I am on windows PC, i cant use the IOS modules, and it gives a ton of error. What about it

    • @ChrisAthanas
      @ChrisAthanas Před 7 měsíci +1

      Sorry you need a Mac for the iOS side

    • @RexTorres
      @RexTorres Před 7 měsíci +1

      You need to have XCode which is only available on macOS, because... Apple.

  • @mohamed-tyb
    @mohamed-tyb Před 7 měsíci +1

    is kmm or kmp is best choise

  • @unknownbiri
    @unknownbiri Před 7 měsíci +6

    Hey. I did code android back then. Then i learned a little web development. But now i can say that coding android was much more fun to me. What do you think is it worth learning android dev in 2024 ? Is there demand ?

    • @ChrisAthanas
      @ChrisAthanas Před 7 měsíci +4

      With KMP it will be the way to produce cross platform apps

    • @unknownbiri
      @unknownbiri Před 7 měsíci +2

      @@ChrisAthanas hmm, that is great reason to come back. I'll think about it

  • @archit7606
    @archit7606 Před 7 měsíci

    Hi. Is your KMM course 69.00£ or 69,00£? Please clarify.

    • @ahmadab9666
      @ahmadab9666 Před 7 měsíci +3

      ??

    • @archit7606
      @archit7606 Před 7 měsíci

      @@ahmadab9666 pl-coding Website he has his courses. There I saw the price for KMM to be £69,00. That's why I asked whether it is £69 or £69,00.

    • @PhilippLackner
      @PhilippLackner  Před 7 měsíci +1

      69 euros. How the decimal is interpreted differs per region

  • @uop6238
    @uop6238 Před 7 měsíci

    I remember Kotlin Multiplatform "mobile" is deprecated 🧐

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 Před 7 měsíci

    Also you should make part two of this video on add KMP code to existing android projectto run it on iOS. Just a simple hello world would do.

  • @pablovaldes6022
    @pablovaldes6022 Před 7 měsíci

    I would rather just git clone and existing template and transfer my Android code to it

  • @rahulraj94391
    @rahulraj94391 Před 7 měsíci

    1st

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 Před 7 měsíci +1

    Anyone getting this error clang: error: no such file or directory: ' -framework shared'

  • @user-gd7nd9yw5q
    @user-gd7nd9yw5q Před 2 měsíci

    i have error "org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.android.application', version: '8.1.2', apply: false] was not found in any of the following sources:
    "

  • @topGfanboy
    @topGfanboy Před 7 měsíci

    😂😂😂... Google Dart has already started interop with JVM... RIP kotlin soon..

  • @mohamed-tyb
    @mohamed-tyb Před 7 měsíci +1

    is kmm or kmp is best choise