dbaroncelli / D-KMP-sample

D-KMP Architecture official sample: it uses a shared KMP ViewModel and Navigation for Compose and SwiftUI apps.
Apache License 2.0
774 stars 87 forks source link

D-KMP-sample-main:composeApp:DesktopMain DKMPViewModel.Factory.getDesktopInstance() unresolved #32

Closed mylockerbiz closed 2 weeks ago

mylockerbiz commented 2 weeks ago

The factory method for desktopMain has DKMPViewModel.Factory.getDesktopInstance() unresolved. The android factory method works fine. I am using unaltered files for the desktopMain in composeApp and shared.

dbaroncelli commented 2 weeks ago

The desktop app seems to run correctly to me. Which error do you get when you run it? Are you selecting the task "compose desktop -> run" in the Gradle window?

mylockerbiz commented 2 weeks ago

Yes, using that. I get the error in code editor before I hit run.

On Sun, Jun 23, 2024, 11:35 AM dbaroncelli @.***> wrote:

The desktop app seems to run correctly to me. Which error do you get when you run it? Are you selecting the task "compose desktop -> run" in the Gradle window?

— Reply to this email directly, view it on GitHub https://github.com/dbaroncelli/D-KMP-sample/issues/32#issuecomment-2185146302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZNM7LG4I5VS3463FW4HOXTZI32LZAVCNFSM6AAAAABJYJADR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBVGE2DMMZQGI . You are receiving this because you authored the thread.Message ID: @.***>

dbaroncelli commented 2 weeks ago

Which error exactly? Can you send me a screenshot?

mylockerbiz commented 2 weeks ago

d-kmp-sample-main getDesktopInstance error

image

dbaroncelli commented 2 weeks ago

That's strange. I don't get that. I am using "Intellij IDEA Community Edition" 2014.1.4

Try to clean the project: "Build -> Clean Project".

mylockerbiz commented 2 weeks ago

using Android Studio Android Studio Jellyfish | 2023.3.1 Patch 1 Build #AI-233.14808.21.2331.11842104, built on May 14, 2024 Runtime version: 17.0.10+0--11572160 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 4 Registry: ide.instant.shutdown=false ide.balloon.shadow.size=0 ide.experimental.ui=true Non-Bundled Plugins: com.jetbrains.kmm (0.8.2(233)-8) org.jetbrains.compose.desktop.ide (1.6.2)

Cleaned Project. Same error

THe getAndroidInstance does not have an issue. it compiles and runs as expected

dbaroncelli commented 2 weeks ago

For Kotlin Multiplatform, you should use either Intellij IDEA or Fleet.

mylockerbiz commented 2 weeks ago

Installed the IntelliJ edition

Running android works fine. Desktop Has the same issue.

e: file:///D:/OWJ/androidStudio-mulitplatform/D-KMP-sample-main/composeApp/src/desktopMain/kotlin/main.kt:13:39 Unresolved reference 'getDesktopInstance'.

IntelliJ IDEA 2024.1.4 (Community Edition)

Build #IC-241.18034.62, built on June 20, 2024

Runtime version: 17.0.11+1-b1207.24 amd64

VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

Windows 11.0

GC: G1 Young Generation, G1 Old Generation

Memory: 4056M

Cores: 4

Registry:

ide.experimental.ui=true

Non-Bundled Plugins:

org.jetbrains.android (241.17011.79)

Kotlin: 241.18034.62-IJ

From: dbaroncelli @.> Sent: Tuesday, June 25, 2024 8:23 AM To: dbaroncelli/D-KMP-sample @.> Cc: mylockerbiz @.>; Author @.> Subject: Re: [dbaroncelli/D-KMP-sample] D-KMP-sample-main:composeApp:DesktopMain DKMPViewModel.Factory.getDesktopInstance() unresolved (Issue #32)

Closed #32 https://github.com/dbaroncelli/D-KMP-sample/issues/32 as completed.

— Reply to this email directly, view it on GitHub https://github.com/dbaroncelli/D-KMP-sample/issues/32#event-13280433139 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AZNM7LGAMRL2W5NRWJ5N2C3ZJFOJDAVCNFSM6AAAAABJYJADR2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGI4DANBTGMYTGOI . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AZNM7LDOIXHCXFYWPHOVK4TZJFOJDA5CNFSM6AAAAABJYJADR2WGG33NNVSW45C7OR4XAZNWJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XKUY3PNVWWK3TUL5UWJTYAAAAAGF4TKPZQ.gif Message ID: @. @.> >

dbaroncelli commented 2 weeks ago

I am using a Mac. I haven't tested it on Windows.