https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
h

HaiTrvn Lưu Trữ

03/04/2021, 10:11 AM
How to reuse model class (like: User::class) in backend module in KMM template?
b

Big Chungus

03/04/2021, 10:32 AM
What exactly are you trying to achieve? Keep in mind that reflection is very limited on non jvm targets
h

HaiTrvn Lưu Trữ

03/04/2021, 10:36 AM
Network synchronization between server and client via model, and it is pure kotlin, my Repository https://github.com/haitrvnvn/KMMM Every time i try add commonMain(inside shared module) model classes to backend module i got this error message:
Copy code
Failed to resolve: project::shared
Affected Modules: KMMM.backend
b

Big Chungus

03/04/2021, 10:38 AM
Must be something due to android target as it's handled differently to others. I'd suggest replacing it with jvm target in shared module (you should still be able to consume it in android project)
h

HaiTrvn Lưu Trữ

03/04/2021, 10:40 AM
I think so, but i’m not figure out solution yet
m

Mustafa Ozhan

03/04/2021, 12:35 PM
@HaiTrvn Lưu Trữ your shared module doesn’t have JVM implementation, and your backend module is a JVM app it can be the reason
please check your `build.gradle.kts`(shared) here is an example from my project my app has also has common module and it is shared with backend: https://github.com/CurrencyConverterCalculator/CCC/blob/master/common/build.gradle.kts
h

HaiTrvn Lưu Trữ

03/05/2021, 2:54 AM
after all it work, thank you guys so much