icerockdev / moko-parcelize

@Parcelize support for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev
Apache License 2.0
67 stars 2 forks source link

IDE error #41

Open Shabinder opened 1 year ago

Shabinder commented 1 year ago

Cannot access 'dev.icerock.moko.parcelize.Parcelable' which is a supertype of 'in.shabinder.soundbound.models.SongModel'. Check your module classpath for missing or conflicting dependencies

shared module's commonMain has moko parcelize as an api

Any ideas ?

Shabinder commented 1 year ago

Compilation works fine, latest Stable Intellij + Android Studio both show red error highlightning.

Alex009 commented 1 year ago

if you add moko-parcelize directly to module where you see this error - error fixes or not?

Shabinder commented 1 year ago

Nope.

burntcookie90 commented 7 months ago

I've also been running into this and its causing further problems because auto-updating of compose previews will not trigger.

burntcookie90 commented 4 months ago

just a heads up, kotlin 2.0 has official support for the functionality provided by this library.

targets.configureEach {
    val isAndroidTarget = platformType == KotlinPlatformType.androidJvm
    compilations.configureEach {
      compileTaskProvider.configure {
        compilerOptions {
          freeCompilerArgs.addAll(
            "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
            "-Xexpect-actual-classes", // used for Parcelize in tests
          )
          if (isAndroidTarget) {
            freeCompilerArgs.addAll(
              "-P",
              "plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=com.example.parcelize.Parcelize",
            )
          }
        }
      }
    }
  }

You can then annotate your KMP models with your custom parcelize annotation.