Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac-aarch64 app crashes when run with double click; windows app crashes when installed with .exe #974

Closed
lydavid opened this issue Jun 29, 2024 · 15 comments
Labels
bug Something isn't working wait

Comments

@lydavid
Copy link
Owner

lydavid commented Jun 29, 2024

Screenshot 2024-06-29 at 2 49 33 PM Screenshot 2024-06-29 at 2 49 46 PM
@lydavid lydavid added the bug Something isn't working label Jun 29, 2024
@lydavid
Copy link
Owner Author

lydavid commented Jun 29, 2024

A workaround is to control click, Show Package Contents -> Contents -> MacOS -> double click MusicSearch.

@lydavid
Copy link
Owner Author

lydavid commented Jul 1, 2024

  • Try without @ComponentScan and ksp

removed but still happening

@lydavid
Copy link
Owner Author

lydavid commented Jul 28, 2024

Crashes for Windows too when run through .exe installer from https://lydavid.github.io/MusicSearch/download.html

@lydavid lydavid changed the title mac-aarch64 crashing when run with double click mac-aarch64 app crashes when run with double click; windows app crashes when installed with .exe Jul 28, 2024
@lydavid
Copy link
Owner Author

lydavid commented Jul 28, 2024

I've tried commenting out that class and all of its usages. The error would change to another class from :shared:domain.

@lydavid
Copy link
Owner Author

lydavid commented Jul 28, 2024

Adding implementation(projects.shared.domain) to :desktop:app didn't fix it

@lydavid
Copy link
Owner Author

lydavid commented Jul 28, 2024

  • build desktop app without koin

This worked

@lydavid
Copy link
Owner Author

lydavid commented Jul 28, 2024

Why does Koin work when run with #974 (comment) but not double clicking?

@lydavid
Copy link
Owner Author

lydavid commented Jul 29, 2024

Related to InsertKoinIO/koin#1639?

@lydavid
Copy link
Owner Author

lydavid commented Jul 29, 2024

Changing "jdbc:sqlite:music_search.db" to JdbcSqliteDriver.IN_MEMORY resolves the crash.
But we want to persist our database.

@lydavid
Copy link
Owner Author

lydavid commented Jul 29, 2024

Existing issue: https://youtrack.jetbrains.com/issue/CMP-5341

@lydavid lydavid added the wait label Jul 29, 2024
@artalejo
Copy link

artalejo commented Sep 9, 2024

Hello there @lydavid , did you find a work around still using the persist database? Or you can just not distribute the app because of this? I am facing the same issue.

What did you replace koin with to have it working? And also, how do you debug it cause for me the local installation works fine as well as installing it from Android Studio.

Thanks a lot in advance.

@lydavid
Copy link
Owner Author

lydavid commented Sep 12, 2024

No, I have not been able to distribute with a persisting database. When I temporarily removed Koin for my desktop app to debug this, it worked because I removed SQLDelight.

@artalejo
Copy link

Right! I did find a solution, please check what they suggested in this Slack thread. Basically you need to set the path of the database depending on the jvm platform that you are distributing so that the operative system does find it.

https://kotlinlang.slack.com/archives/C01D6HTPATV/p1725877136015339

I have used https://github.com/psuzn/multiplatform-paths library to find the cache path independent on the platform and then proceed to use it in the sqldelight driver.

actual class GameDetailsDatabaseDriver {
    actual fun createDriver(): SqlDriver {
        val appCacheDirectory = appCacheDirectory(appId = jvmPackageName, createDir = true)
       ---> This is the important part, using the cache directory path in the jdbc:sqlite.
        return JdbcSqliteDriver(
            url = "jdbc:sqlite:$appCacheDirectory/gameDetails.db", 
            schema = GameDetailsDatabase.Schema
        )
    }
}

Let me know if it helps.

lydavid added a commit that referenced this issue Oct 4, 2024
@lydavid
Copy link
Owner Author

lydavid commented Oct 4, 2024

Hey, thanks for this detailed response! Sorry, I didn't see this sooner. I've tried your solution locally and it worked perfectly.

I'll test the deploy tomorrow and report back.

lydavid added a commit that referenced this issue Oct 4, 2024
…preferences data store in a location that is writable by our app

#974 (comment)
@lydavid
Copy link
Owner Author

lydavid commented Oct 4, 2024

I've verified it on Mac and Windows. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wait
Projects
None yet
Development

No branches or pull requests

2 participants