Hi Arkadii, i'm running into <this issue> when I t...
# decompose
x
Hi Arkadii, i'm running into this issue when I try to include
parcelize-darwin
plugin. Any clue as to whats causing this issue?
Copy code
> Task :core:compileKotlinIosSimulatorArm64 FAILED
e: Compilation failed: Front-end Internal error: Failed to analyze declaration BackgroundWorkData
File being compiled: (5,1) in BackgroundWorkers.kt
The root cause java.lang.NoClassDefFoundError was thrown at: com.arkivanov.parcelize.darwin.ParcelizeResolveExtension.generateSyntheticClasses(ParcelizeResolveExtension.kt:13)

 * Source files: ..
 * Compiler version info: Konan: 1.8.10 / Kotlin: 1.8.10
 * Output kind: LIBRARY

e: org.jetbrains.kotlin.util.KotlinFrontEndException: Front-end Internal error: Failed to analyze declaration BackgroundWorkData
File being compiled: (5,1) in BackgroundWorkers.kt
The root cause java.lang.NoClassDefFoundError was thrown at: com.arkivanov.parcelize.darwin.ParcelizeResolveExtension.generateSyntheticClasses(ParcelizeResolveExtension.kt:13)
1
a
Hey! Glad you resolved the issue. Though I still don't get why it was happening. The outdated Essenty version is already compiled, so shouldn't affect compilation of projects where it's used.
x
yeah it was weird indeed 🤔 not entirely sure if this was indeed resolved by just bumping Essenty
I'm also running into this issue when building my native client now -
Copy code
> Task :app:ui:linkPodDebugFrameworkIosSimulatorArm64

Showing All Messages
e: Module "PSCore.core:ui" has a reference to symbol [ au.com.gridstone.pscore.core.ui.navigation/rememberRouter|-3103101331561201202[0] <- local Local[<TP>,0 | TYPE_PARAMETER name:C index:0 variance: superTypes:[com.arkivanov.parcelize.darwin.Parcelable{ com.arkivanov.essenty.parcelable.Parcelable }] reified:false] ]. Neither the module itself nor its dependencies contain such declaration.
my
:app:ui
and
:core:ui
modules does have this
Copy code
listOf(
  iosX64(),
  iosArm64(),
  iosSimulatorArm64(),
).forEach { targets ->
  targets.binaries {
    framework {
      export(Arkivanov.parcelzieDarwinRuntime)
    }
  }
}
so not sure why it is not seeing the dependency.
a
Oh, this one is tricky. I've seen similar errors multiple times with Compose and other libraries. Not sure what's the problem yet. A reproducer could help though.
Looks similar to https://youtrack.jetbrains.com/issue/KT-53523/Compose-jb-for-iOS-Neither-the-module-itself-nor-its-dependencies-contain-such-declaration. You can the workaround there . Also, does it work without parcelize-darwin?
x
let me give that a try - ill get a reproducer out to debug this further 👍
Not sure im using the right version of decompose 🤔 currently im using
1.0.0-compose-experimental
with • Kotlin:
1.8.10
• Essenty:
1.0.0
parcelize-darwin:
0.1.3
(removed the plugin and runtime from my project) • JetBrains Compose:
1.3.1-rc02
Copy code
> Task :app:ui:linkPodDebugFrameworkIosSimulatorArm64
e: Module "PSCore.core:ui" has a reference to symbol [ au.com.gridstone.pscore.core.ui.navigation/rememberRouter|-3103101331561201202[0] <- local Local[<TP>,0 | TYPE_PARAMETER name:C index:0 variance: superTypes:[com.arkivanov.parcelize.darwin.Parcelable{ com.arkivanov.essenty.parcelable.Parcelable }] reified:false] ]. Neither the module itself nor its dependencies contain such declaration.

This could happen if the required dependency is missing in the project. Or if there is a dependency of "PSCore.core:ui" that has a different version in the project than the version that "PSCore.core:ui" was initially compiled with. Please check that the project configuration is correct and has consistent versions of all required dependencies.

The list of "PSCore.core:ui" dependencies that may lead to conflicts:
 1. "PSCore:core" (a library with unknown version)
 2. "app.cash.molecule:molecule-runtime" (a library with unknown version)
 3. "co.touchlab:kermit" (a library with unknown version)
 4. "co.touchlab:stately-common" (a library with unknown version)
 5. "co.touchlab:stately-concurrency" (a library with unknown version)
 6. "com.arkivanov.decompose:decompose (com.arkivanov.decompose:decompose-iossimulatorarm64): 1.0.0-compose-experimental" (was initially compiled with "com.arkivanov.decompose:decompose (com.arkivanov.decompose:decompose-iossimulatorarm64)")
 7. "com.arkivanov.decompose:extensions-compose-jetbrains (com.arkivanov.decompose:extensions-compose-jetbrains-iossimulatorarm64): 1.0.0-compose-experimental" (was initially compiled with "com.arkivanov.decompose:extensions-compose-jetbrains (com.arkivanov.decompose:extensions-compose-jetbrains-iossimulatorarm64)")
 8. "com.arkivanov.essenty:back-handler (com.arkivanov.essenty:back-handler-iossimulatorarm64): 1.0.0" (was initially compiled with "com.arkivanov.essenty:back-handler (com.arkivanov.essenty:back-handler-iossimulatorarm64)")
 9. "com.arkivanov.essenty:instance-keeper (com.arkivanov.essenty:instance-keeper-iossimulatorarm64): 1.0.0" (was initially compiled with "com.arkivanov.essenty:instance-keeper (com.arkivanov.essenty:instance-keeper-iossimulatorarm64)")
10. "com.arkivanov.essenty:lifecycle (com.arkivanov.essenty:lifecycle-iossimulatorarm64): 1.0.0" (was initially compiled with "com.arkivanov.essenty:lifecycle (com.arkivanov.essenty:lifecycle-iossimulatorarm64)")
11. "com.arkivanov.essenty:parcelable (com.arkivanov.essenty:parcelable-iossimulatorarm64): 1.0.0" (was initially compiled with "com.arkivanov.essenty:parcelable (com.arkivanov.essenty:parcelable-iossimulatorarm64)")
12. "com.arkivanov.essenty:state-keeper (com.arkivanov.essenty:state-keeper-iossimulatorarm64): 1.0.0" (was initially compiled with "com.arkivanov.essenty:state-keeper (com.arkivanov.essenty:state-keeper-iossimulatorarm64)")
13. "com.arkivanov.essenty:utils-internal (com.arkivanov.essenty:utils-internal-iossimulatorarm64): 1.0.0" (was initially compiled with "com.arkivanov.essenty:utils-internal (com.arkivanov.essenty:utils-internal-iossimulatorarm64)")
14. "com.arkivanov.parcelize.darwin:runtime (com.arkivanov.parcelize.darwin:runtime-iossimulatorarm64): 0.1.3" (was initially compiled with "com.arkivanov.parcelize.darwin:runtime (com.arkivanov.parcelize.darwin:runtime-iossimulatorarm64)")
Let me know if anything looks off - either way i'll get a reproducer out soon
a
Can you try kotlin 1.8.0 and compose 1.3.0?
It seems that the issue is with the rememberRouter function. Where does it come from?
x
It's the same from this https://link.medium.com/83mAkw4q1xb
a
I mean in which module?
x
It's in a
:core:ui
module and consumed by
:app:ui
module
a
This looks like a bug in compose. You can also try making your rememberRouter function not inline.
So another try would be removing default argument values from that function.
x
managed to extract a reproducer for this issue here
Copy code
Shortly: The required symbol [ io.github.xxfast.krouter/rememberRouter|-3103101331561201202[0] <- local Local[<TP>,0 | TYPE_PARAMETER name:C index:0 variance: superTypes:[com.arkivanov.parcelize.darwin.Parcelable{ com.arkivanov.essenty.parcelable.Parcelable }] reified:false] ] is missing in the module or module dependencies. This could happen if the required dependency is missing in the project. Or if there is a dependency that has a different version (without the required symbol) in the project than the version (with the required symbol) that the module was initially compiled with.
had no luck with making
rememberRouter{}
not
inline
/ removing the default arguments 😕 Yeah you are right this most definitely looks like a compose-jb issue
a
Thanks, I will check tonight
Here are some updates. Basically, making the
rememberRouter
function not inlined fixes the issue (and then the same issue happens with
rememberViewModel
). As a workaround, instead of
reified C
you can pass
KClass<out C>
. However, inlined functions worked fine for me. Most likely because I don't export the whole shared module to iOS. Instead, I have a separate tiny module for Compose iOS app. This module just integrates the root component and UI from the shared module, without exposing it I guess.
x
Most likely because I don't export the whole shared module to iOS. Instead, I have a separate tiny module for Compose iOS app
Do you mean something like this? Still seem to run into the same issue even then 🤔 let me try removing the inlines
Removed all the inline classes and it works 🙌🏻. I also ran into a few more similar issues (with
LazyGrids
) so this definitely has nothing to do with decompose
I will raise a few issues on compose-jb and post the links here if you want to keep track - but this issue is now solved 👍 Thanks for all your help @Arkadii Ivanov
a
Thanks! Yes, this seems like a bug in Compose. However, it definitely works in my Compose iOS sample! Not sure what's the difference.
a
Thanks for filling the issue!
258 Views