I recently ran into this error when running compil...
# decompose
l
I recently ran into this error when running compileIosMainKotlinMetadata
Copy code
Cannot access 'com.arkivanov.decompose.ComponentContext' which is a supertype of 'com.example.myapp.component.TrimComponent'. Check your module classpath for missing or conflicting dependencies
The normal build process runs just fine, there’s no errors showing up in the IDE, and the app works, but I can’t publish my library because maven-publish tasks rely on the metadata task. I have some parts of the app set up as a library that the main app pulls in.
This error shows up for every usage of my TrimComponent class. As of now, this is my only Component.
a
It looks like your module depends on another module containing
TrimComponent
. You should also add
decompose
as a dependency.
l
I have this line in the commonMain dependencies block of my build.gradle.kts
Copy code
implementation("com.arkivanov.decompose:decompose:0.6.0")
a
Without a reproducer it's hard to say what is wrong exactly. But in general that error says that Decompose is a transitive dependency there and ComponentContext can't be accessed.
l
I’ll look into making a repro over the weekend.
👍 1
This project has few modules, so TrimComponent is directly part of the module that failed. I’m hoping that I just set something up wrong in my build.gradle.kts
a
Thanks!
l
I was unable to reproduce the issue on a smaller project. I’ve checked my build gradle and confirmed that decompose is listed as a dependency in commonMain of the modules that use it. The app compiles and runs fine. It’s just this metadata task that’s failing.
a
What Kotlin version are you using?
So far I have found a similar issue - https://github.com/cashapp/sqldelight/issues/2590 It's not clear yet what was the solution, but I suspect there might be some issues with HMPP. Decompose depends on Kotlin 1.6.10 so far and HMPP is disabled for now. I will double check if there is anything wrong.
l
I’m using 1.6.21 and for Compose, I’m using compose-jb 1.2.0-alpha01-dev686
a
That might be an issue. I remember something like they changed the metadata format recently.
Is there any reason why you need the unstable Compose version? Maybe you could downgrade to 1.6.10 and 1.1.1 respectively?
Even though it is recommended to use stable versions, but if you really need Compose
1.2.0-x
, then you can try Decompose version 0.6.0-native-compose-01 - https://github.com/arkivanov/Decompose/releases/tag/0.6.0-native-compose-01 This version uses Kotlin 1.6.21 and Compose
1.2.0-alpha01-dev675
. It experimentally supports the new iOS and macOS native targets. But if you don't use them, this shouldn't bother you.
l
I’m on the experimental versions so I can add iOS support easily once compose for iOS is more stable. I can look into downgrading to 1.1.1 for now and upgrade later.
a
Yeah! Compose for iOS is not quite ready yet.
l
I finally got the chance to focus on fixing this issue in the app (We recently had a release for the app and it’s ben keeping me busy lately). It looks like switching to 0.6.0-native-compose01 with compose dev675 resolved the issue. I can now publish without having to manually run the last few publications after the ios fails.
K 1
s
https://github.com/icerockdev/moko-parcelize/issues/41 Related, also happens when using essenty parcelable, and event tried publishing my own, IDE shows red error, but build always work
Copy code
Cannot access 'in.shabinder.soundbound.parcelize.Parcelable' which is a supertype of 'in.shabinder.soundbound.models.SongModel'. Check your module classpath for missing or conflicting dependencies.
another interesting thing is, the red highlight only comes in
androidMain
, other source sets work fine without any ide error, and build also works. • If I remove library dependency in commonMain, and add in androidMain instead, error disappears from androidMain, but commonMain then obviously cant resolve and build fails. lmk if I can provide any more details or any helpful info on same, this has been quite annoying since most of code in androidMain accessing model shows error, but works just fine.
a
Those errors are most likely KMP issues. Feel free to file a bug on YouTrack.
On androidMain you can try using Parcelable/Parcelize from Android, not from Essenty.
s
So, My SongModel resides in commonMain in library artifact which extends parcelable. Now I have mainProject • Module : Extension (kmp module) ◦ api dependency on libNo issues or errors here even in android main • Module: Shared (another kmp module) ◦ implementation dependency on project extension. ◦ This gives error
a
I think you also need to add Essenty as a dependency for the second module. And apply kotlin-parcelize plugin there as well.
s
have done both already
a
Does the project compile?
s
yes compile and builds fine. • another interesting thing, even if i remove in shared module dependency on project extension. • and use dependency on lib directly, error's still there. So something with shared module I suppose. but below somehow fixes the conflict atleast for androidMain, but then I cant builds
If I remove library dependency in commonMain, and add in androidMain instead, error disappears from androidMain, but commonMain then obviously cant resolve and build fails.
a
If the project compiles, and you are sure that you have added Essenty
parcelable
module as a dependency in your Shared module, then this must be an issue with KMP/IDE.
Also maybe try aligning versions of Decompose and Essenty. I.e. use the same Essenty version that is used by the version of Decompose.
Update Kotlin version, etc. 🙂 I don't think there is anything we could do at the library level.
s
but it should have worked when I use moko-parcelize or my custom lib, if was versioning conflict. I believe too, its IDE issue, will see if I can build a minimal reproducer.
a
Essenty Parcelize shound't be compatible with Moko parcelize in commonMain
s
Yes, I meant not using essenty parcelize and instead using moko in all, and using my own in all.
a
You can try updating Kotlin and/or IDE (including Kotlin IDEA plugin) to the latest versions
s
will do and report back. thanks for the info.
👍 1
IDE and plugin updates didnt fixed this. Found this, seems exactly what I am facing: https://youtrack.jetbrains.com/issue/KTIJ-10861/
a
Looking at the description of the issue, it looks a bit different. There they have: "lib is a binary dependency included into the project as a library, it has compile time dependency on module1", where "module1 is a module in the project". But in your case, I think
lib
is Essenty and it doesn't depend on any of your project modules.
👀 1
s
Update in here: • A nice side-effect of migrating to serializable is, above doesn't come anymore in my IDE. Finally clean looking project files to work with, no more false red-highlights.
👍 1
🎉 1