GithubHelp home page GithubHelp logo

Comments (13)

sdzshn3 avatar sdzshn3 commented on June 13, 2024 1

Sure. I'll create a sample project. If it works, obviously there is something wrong in my specific project (as i have added desktop target manually into a KMM project).

from decompose.

sdzshn3 avatar sdzshn3 commented on June 13, 2024 1

Ignore about Koin, Hilt and multiple compose dependencies.

Initially I started the project with just Android and iOS (with native UIs).
But then started to migrate to a full KMP project slowly migrating from hilt in Android to koin in shared and jetpack compose from Android to jetbrains compose in shared.

You can already see i commented hilt implementation

Will remove hilt and Jetpack Compose eventually after migration.

from decompose.

sdzshn3 avatar sdzshn3 commented on June 13, 2024 1

And now regarding the actual issue,

It's only happening in desktop.

So far I tried running the desktop app by using the green triangle "Play icon” button in the main function of desktop.

But, now I just tried running by creating a custom configuration as @JuBan1 suggested. Now it's working.

And thanks for remaining version suggestions. Since the app was working well in Android and iOS, I was expecting it to work in Desktop automatically.

And I didn't upgrade to Kotlin 1.9.10 is because, in Android Studio that version plugin is not yet available.

Regarding the sql error, this is surprising... In Android and iOS, it's working just with CREATE TABLE. Any way, I'll change it to IF NOT EXISTS and it's more fail safe.

from decompose.

arkivanov avatar arkivanov commented on June 13, 2024 1

Thanks for the update! Closing the issue.

from decompose.

arkivanov avatar arkivanov commented on June 13, 2024

Please see: #464

from decompose.

sdzshn3 avatar sdzshn3 commented on June 13, 2024

No luck even after adding those flags in command line options.

from decompose.

arkivanov avatar arkivanov commented on June 13, 2024

It would be nice to have a reproducer. It really looks like an issue with your environment.

from decompose.

sdzshn3 avatar sdzshn3 commented on June 13, 2024

I trimmed down my project and made this as a reproducer for you.

https://github.com/sdzshn3/DecomposeRepro

from decompose.

arkivanov avatar arkivanov commented on June 13, 2024

Thanks! Are there any specific steps to produce? I have successfully launched the desktop app via ./gradlew :desktop:run once. Subsequent runs throw an error which looks unrelated to Decompose.

Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (table setting already exists)
	at org.sqlite.core.DB.newSQLException(DB.java:1179)
	at org.sqlite.core.DB.newSQLException(DB.java:1190)
	at org.sqlite.core.DB.throwex(DB.java:1150)
	at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
	at org.sqlite.core.NativeDB.prepare(NativeDB.java:126)
	at org.sqlite.core.DB.prepare(DB.java:264)
	at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:46)
	at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:32)
	at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:25)
	at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:34)
	at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:226)
	at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:206)
	at app.cash.sqldelight.driver.jdbc.JdbcDriver.execute(JdbcDriver.kt:130)
	at app.cash.sqldelight.db.SqlDriver$DefaultImpls.execute$default(SqlDriver.kt:63)
	at com.omniwyse.smarttrackadmin.database.shared.SmartTrackAdminDatabaseImpl$Schema.create-0iQ1-z0(SmartTrackAdminDatabaseImpl.kt:30)
	at com.omniwyse.smarttrackadmin.database.shared.SmartTrackAdminDatabaseImpl$Schema.create(SmartTrackAdminDatabaseImpl.kt:25)
	at com.omniwyse.smarttrackadmin.core.data.local.SqlDriverFactoryKt.sqlDriverFactory(SqlDriverFactory.kt:10)
	at com.omniwyse.smarttrackadmin.di.AppModuleKt$appModule$1$1.invoke(AppModule.kt:20)
	at com.omniwyse.smarttrackadmin.di.AppModuleKt$appModule$1$1.invoke(AppModule.kt:20)
	at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:54)
	... 34 more

from decompose.

arkivanov avatar arkivanov commented on June 13, 2024

As a workaround, changed the SQL statement to CREATE TABLE IF NOT EXISTS and the app starts fine every time.

from decompose.

malliaridis avatar malliaridis commented on June 13, 2024

I launched your project for desktop and it works fine for me too. For Android I had to upgrade to Kotlin 1.9.10 due to the Compose Compiler (1.5.3) compatibility. I also had to remove the signing configuration since the configuration was otherwise invalid.

I looked into your dependencies and versions and noticed the following:

  • You are adding multiple android compose dependencies to your androidApp, even though you don't need any of these in your example. I would let Compose Multiplatform manage the dependencies and add only androidx.activity:activity-compose1.7.2 to the android module
  • You are using moko resources 0.23.0, which is not compatible with Kotlin 1.9.0, the upcoming version 0.24.0 will be, see icerockdev/moko-resources#575
  • You are using io.github.raamcosta.compose-destinations, which, if I am correct, adds navigation, which should normally be handled by Decompose due to the component state management.
  • Koin 3.5.0. introduced support for Kotlin 1.9.0, but you are using 3.2.0
  • I couldn't find any changelog that says that SQLDelight 2.0.0 is compatible yet with Kotlin 1.9.0, is it confirmed that it works?
  • The compose compiler 1.5.3 requires Kotlin 1.9.10 (see https://developer.android.com/jetpack/androidx/releases/compose-kotlin#pre-release_kotlin_compatibility). It should probably work anyway, but prefer to upgrade to 1.9.10 if supported by other dependencies too

And a personal recommendation, I would not use Koin or Hilt in combination with Decompose, it will overcomplicate your project.

from decompose.

JuBan1 avatar JuBan1 commented on June 13, 2024

It is only when running the desktop app?

I've encountered the same runtime problem. Not with Decompose but with Ktor, and after removing Ktor something else took its place.

It's not a Decompose problem but instead a problem of how IntelliJ/Android Studio packages and runs the executable. Apparently it doesn't supply the correct class paths (?) in some cases. gradlew run works just fine, however. My workaround was to avoid the default run configuration created by IJ and use a custom gradle configuration that executes run instead.

I wasn't able to find a specific reason for why it happens. At first I thought it was because of a specific Android Studio version but I tested it on several machines with different results.

from decompose.

arkivanov avatar arkivanov commented on June 13, 2024

Thanks for all the useful information!

from decompose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.