icerockdev / moko-mvvm

Model-View-ViewModel architecture components for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
1.03k stars 95 forks source link

Kotlin Multiplatform Mobile (KMM) plugin + moko-mvvm? #63

Closed Diy2210 closed 2 years ago

Diy2210 commented 4 years ago

Hi, I try use moko-mvvm + kotlin multiplatform mobile (KMM), but it not work! I get some error: 1

2 3 4

Alex009 commented 4 years ago

while moko-resources and mvvm not updated to 1.4.10 this lines required:

    // temporary fix of https://youtrack.jetbrains.com/issue/KT-41083
    commonMainImplementation("dev.icerock.moko:resources:0.13.0")
    commonMainImplementation("dev.icerock.moko:parcelize:0.4.0")
    commonMainImplementation("dev.icerock.moko:graphics:0.4.0")
Diy2210 commented 4 years ago

Oh, where I do add this lines in shared build.gradle.kts? I add it in block? kotlin { sourceSets { ... } }

Снимок экрана 2020-09-24 в 16 33 02

Alex009 commented 4 years ago

@Diy2210 you can add dependencies in dependencies block out of kotlin block, or add implementation dependency inside kotlin.sourceSets.commonMain.dependencies for example - https://github.com/icerockdev/moko-permissions/blob/master/sample/mpp-library/build.gradle.kts

Diy2210 commented 4 years ago

I add dependencies in dependencies block out of kotlin block, sync gradle is ok. Library add External Lib, but ViewModel class dont work - Unresolved Reference :(

Снимок экрана 2020-09-25 в 15 44 18

Снимок экрана 2020-09-25 в 15 42 04

Alex009 commented 4 years ago

@Diy2210 you create android target? not jvm? maybe you can show project? i can try it and find fix

Diy2210 commented 4 years ago

I create android target, maybe I forgot something. I will be grateful for the help. https://github.com/Diy2210/KMM

Alex009 commented 4 years ago

@Diy2210 here PR with correct configuration of project - https://github.com/Diy2210/KMM/pull/1

mathemandy commented 4 years ago

This helped me, thanks !!