icerockdev / moko-mvvm

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

Error Cannot access ViewModel #64

Closed Diy2210 closed 2 years ago

Diy2210 commented 3 years ago

I get some error: Cannot access 'dev.icerock.moko.mvvm.viewmodel.ViewModel' which is a supertype of 'net.compoza.deactivator.mpp.model.ListViewModel'. Check your module classpath for missing or conflicting dependencies.

ViewModel class: Снимок экрана 2020-09-29 в 12 32 27

Fragment code: Снимок экрана 2020-09-29 в 12 32 07

shared build.gradle: Снимок экрана 2020-09-29 в 12 36 11 Снимок экрана 2020-09-29 в 12 36 20

I use: Android Studio: 4.0.1 Kotlin: 1.4.10 gradle: 6.6 build.gradle: 4.0.1 And block Android() in shared build.gradle.

Alex009 commented 3 years ago

Lifecycle extensions should be Android dependency, not common.

See readme setup block

Diy2210 commented 3 years ago

I move lifecycle extensions to android dependency, but error dont gone. Cannot access 'dev.icerock.moko.mvvm.viewmodel.ViewModel'

error: cannot generate view binders com.sun.tools.javac.code.Symbol$CompletionFailure: class file for dev.icerock.moko.mvvm.viewmodel.ViewModel not found

build.gradle: Снимок экрана 2020-09-29 в 12 50 09

Diy2210 commented 3 years ago

Dependency Android: Снимок экрана 2020-09-29 в 13 02 08

Dependency Shared: Снимок экрана 2020-09-29 в 12 59 44

Снимок экрана 2020-09-29 в 13 01 11

Alex009 commented 3 years ago

now problem with databinding logic. try change implementation to api dependency definition of moko-mvvm. or add moko-mvvm to app module dependencies directly

urgentx commented 3 years ago

Change your commonMain moko-mvvm dependency declaration from implementation to api