How to Setup a Room DB for Kotlin Multiplatform Compose

  Рет қаралды 9,436

Philipp Lackner

Philipp Lackner

Ай бұрын

In this video I'll show you how to set up a Room DB for Kotlin Multiplatform Compose!
💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:
pl-coding.com/drop-table-ment...
⭐ Courses with real-life practices
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:
pl-coding.com/premium-courses...
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
Get the source code for this video on GitHub:
github.com/philipplackner/Roo...

Пікірлер: 61
@Fo0nT
@Fo0nT Ай бұрын
There it is, nice! Next video suggestions: - Preparing for Kotlin 2.0 - Compose Preview Screenshot testing
@gerardosanchez7548
@gerardosanchez7548 Ай бұрын
No gonna lie, today i was decided to implement Rom in KMP with the documentation provided for google. And Philipp comes with this video, it is truly insane. Philipp you saved my day, tanks a lot!!!
@stasleonov5196
@stasleonov5196 Ай бұрын
Philipp, I spent two days trying to do this, and here’s your video! Lord, give you everything you want and thank you so much
@PhilippLackner
@PhilippLackner Ай бұрын
Glad I could help!
@peterpaniccc
@peterpaniccc Ай бұрын
Thank you Philipp, extremely helpful content. I'll stick to realm, but good to know room is now also supported.
@MrBeskem
@MrBeskem 17 күн бұрын
Danke man, ich liebe deine Videos.
@sijanneupane
@sijanneupane Ай бұрын
damn Philipp! you're speeding up! ❤
@AravindhAthmanathan
@AravindhAthmanathan Ай бұрын
Hi Philipp, Can we use Room for Desktop also ?
@andreaslinis1586
@andreaslinis1586 Ай бұрын
I used to have roomdb then wanted to migrate for kotlin multiplatform so changed to sqldelight. Now room is available for kotlin multi platform too. Too late 😂😂😂
@vinupolly3558
@vinupolly3558 Ай бұрын
For Kotlin 2.0.0, there seems to be an issue syncing 'Cannot change attributes of configuration ':composeApp:debugFrameworkIosX64' after it has been locked for mutation', have used the latest KSP so that IDE identifies generated sources, but still throwing this error. Any one had any luck with this?
@ZAKIALAM
@ZAKIALAM 28 күн бұрын
Philips this error is emerged from Kotlin 2.0.0 and KSP 2.0.0. Could you please help ?
@kocur-pl
@kocur-pl 25 күн бұрын
i have same error
@bardeebooboo
@bardeebooboo 24 күн бұрын
same...
@panagiotismargaritis3531
@panagiotismargaritis3531 20 күн бұрын
I had the same issue. Replace (for now) : dependencies { //room //Replace it with -> ksp(libs.room.compiler) when it is stable add("kspCommonMainMetadata", libs.room.compiler) } tasks.withType().configureEach { if (name != "kspCommonMainKotlinMetadata" ) { dependsOn("kspCommonMainKotlinMetadata") } } I think they will notice and they will come up with a change.
@mohitcharadva1655
@mohitcharadva1655 7 күн бұрын
@@panagiotismargaritis3531 For me it still not work, throws error -> error: Unresolved reference 'instantiateImpl'.
@ALEX54402
@ALEX54402 Ай бұрын
🎉🎉🎉 keep going
@m.fatihyldz8159
@m.fatihyldz8159 Ай бұрын
damn i feel like u read my mind, thats what i was looking for :)
@user-vs9ey3bd4t
@user-vs9ey3bd4t Ай бұрын
Ive foudn th best kotlin youtuber.
@MaksimLA
@MaksimLA Күн бұрын
Great video, thanks! By the way, context exists on iOS as well. Core Data, which is the native persistence method in iOS, uses it too. However, for some reason, Kotlin databases on iOS, like Room or SQLDelight, don't seem to require it.
@PhilippLackner
@PhilippLackner Күн бұрын
Interesting, they're still two different contexts though 😄
@mohammadhosein8378
@mohammadhosein8378 Ай бұрын
please create a playlist for KMP videos on your channel for better access 🙏
@o_zz
@o_zz Ай бұрын
Could you make Playlist for KMP?
@betterboyfilms
@betterboyfilms Ай бұрын
Hi, whats your theme in Android Studio?
@Joshdevelopsdaily
@Joshdevelopsdaily Ай бұрын
Can you pre-populate the DB in the ios main similar to how its done in android?
@tmjromao
@tmjromao Ай бұрын
Philipp many thanks for the video explanation. Could you explain how to implement dependency injection in this project? how to inject the room database in the viewmodel, shared amongst Android and iOS? thanks, best regards
@PhilippLackner
@PhilippLackner Ай бұрын
Check my recent video on how to share ViewModels and then connect these two :)
@MahmoudBashir-dd4or
@MahmoudBashir-dd4or Ай бұрын
Could you please integrating it with koin in kmm
@andreaslinis1586
@andreaslinis1586 Ай бұрын
Philip is it safe to use compose multiplatform for production in this point or is it a bit risky with alpha version? (Jetbrains focus to release beta this year)
@PhilippLackner
@PhilippLackner Ай бұрын
I wouldn't yet
@khanhNguyen-ts6gj
@khanhNguyen-ts6gj Ай бұрын
How can you have code suggestion on kotlin files of iosMain package? Mine Android studio only treated like a plain text files :(
@user-vs9ey3bd4t
@user-vs9ey3bd4t Ай бұрын
How to add dao on wasm and desktop app
@nishantaanjaneyjalan8583
@nishantaanjaneyjalan8583 22 күн бұрын
Hey Philipp, great video! However, I noticed that you did all of your code in :composeApp. Why did you take this approach and not in the :shared module? I was under the impression that :shared is used for business logic...
@deriarmanda7807
@deriarmanda7807 20 күн бұрын
composeApp is a shared module. Right now, they shipped android and kmm together into one module named composeApp by default if you create project from kmp wizard.
@nishantaanjaneyjalan8583
@nishantaanjaneyjalan8583 17 күн бұрын
@@deriarmanda7807 Yeah that was quite confusing for me. Now I use `shared/` module for stuff that is shared between the app the server like serializing request/response bodies and type-safe routing.
@RajeshJaswalPune
@RajeshJaswalPune Ай бұрын
error: Unresolved reference 'instantiateImpl'
@VikramKirubaharan
@VikramKirubaharan 7 күн бұрын
Same issue here. Did anyone found the root cause and resolved this issue?
@MrMarv37
@MrMarv37 Ай бұрын
Would this be the same way to implement room in an intellij desktop project?
@LassNoches
@LassNoches Ай бұрын
I want to know this too
@PhilippLackner
@PhilippLackner Ай бұрын
Yes for Desktop it works as well
@MrMarv37
@MrMarv37 Ай бұрын
​@@PhilippLacknerthank you. And how do you create an instance of a room db in an intellij desktop only project?
@MrMindfullness
@MrMindfullness Ай бұрын
If some one from subscriber knows how to login to account on pl-coding, please reply. I am not able to see a way to login on pl-coding. I want to access course that I enrolled for.
@abada-s
@abada-s Ай бұрын
I hope to create a video about migrate from android project to kmp project
@PhilippLackner
@PhilippLackner Ай бұрын
Already done
@abada-s
@abada-s Ай бұрын
@@PhilippLackner I don't think that I missed a video for you, I mean if there is an existing android project, how to migrate its settings and configurations to be a kmp one
@VikramKirubaharan
@VikramKirubaharan 7 күн бұрын
Hii Philipp.. KSP has generate source code but instantiateImpl() is not resolved in iOS SourceSet. But it is resolved in Android SourceSet. I couldn't figure out the root cause. I have checked generated build folder. I found the method in both iOS & Android generated files but am not getting why it is not resolved in iOS source set resulting in build failure. Please help us to resolve this.
@PhilippLackner
@PhilippLackner 7 күн бұрын
Just launch the app, it'll work :)
@vikramkirubaharan7737
@vikramkirubaharan7737 5 күн бұрын
@@PhilippLackner Thanks for responding. And thanks a lot for your contribution towards Android Community..
@MrMindfullness
@MrMindfullness Ай бұрын
How to login to my account on pl-coding website?
@PhilippLackner
@PhilippLackner Ай бұрын
After the purchase you got an email with instructions to set a password on Memberspot. Then you just need to log in there with the link in the email :)
@MrMindfullness
@MrMindfullness Ай бұрын
@@PhilippLackner Thanks for reply! I was searching in emails by your name. Now I got it.
@johnkenedy
@johnkenedy 27 күн бұрын
@arozendojr
@arozendojr Ай бұрын
I would like to see compose-ios, using a simple Android and ios webview
@PhilippLackner
@PhilippLackner Ай бұрын
Already have a 3h course here on KZfaq :)
@Elkmor2
@Elkmor2 5 күн бұрын
If you want to show off multiplatform, it is a bad idea to do so on Android. We already know it works in Android, there is no point
@frank4pickerson
@frank4pickerson Ай бұрын
Why not use mongodb?
@fernandobatista3528
@fernandobatista3528 Ай бұрын
Coisa de mongol
@alexbecar977
@alexbecar977 Ай бұрын
Because its trash for most use cases
@PhilippeNajem
@PhilippeNajem 5 күн бұрын
On a physical iOS device (iPhone), I encountered an error when using NSHomeDirectory in the databaseBuilder: Error Domain=KotlinException Code=0 "Unable to open lock file (Operation not permitted)". However, this issue did not occur on the simulator, where it worked fine. To resolve this, I replaced: val dbFile = NSHomeDirectory() + "/myDatabase.db" with val docDirectoryUrl = NSFileManager.defaultManager().URLForDirectory(NSDocumentDirectory, NSUserDomainMask, null, true, null) val dbFile = docDirectoryUrl?.path + "/myDatabase.db" and it worked fine. Does anyone have other suggestions? Thanks.
@JeeMorpheus
@JeeMorpheus 4 күн бұрын
this helped me as well
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 30 М.
MEGA BOXES ARE BACK!!!
08:53
Brawl Stars
Рет қаралды 31 МЛН
A pack of chips with a surprise 🤣😍❤️ #demariki
00:14
Demariki
Рет қаралды 51 МЛН
WHO DO I LOVE MOST?
00:22
dednahype
Рет қаралды 22 МЛН
Software engineer interns on their first day be like...
2:21
Frying Pan
Рет қаралды 13 МЛН
Looking Forward to Kotlin 2.0
10:36
Dave Leeds
Рет қаралды 15 М.
Kotlin Multiplatform vs Flutter: Which should we use?
4:42
Kei Fujikawa
Рет қаралды 13 М.
Designing scalable Compose APIs
19:53
Android Developers
Рет қаралды 12 М.
Everything you need to know about Kotlin 2.0 🟣
11:05
Stevdza-San
Рет қаралды 53 М.
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
Alex Hyett
Рет қаралды 192 М.
Releasing Faster with Kotlin Multiplatform
32:24
Gradle
Рет қаралды 10 М.
The Top 3 State Management Mistakes On Android
14:30
Philipp Lackner
Рет қаралды 21 М.
🔥Идеальный чехол для iPhone! 📱 #apple #iphone
0:36
Не шарю!
Рет қаралды 1,3 МЛН
Секретный смартфон Apple без камеры для работы на АЭС
0:22
Lid hologram 3d
0:32
LEDG
Рет қаралды 5 МЛН
iPhone 12 socket cleaning #fixit
0:30
Tamar DB (mt)
Рет қаралды 49 МЛН