https://kotlinlang.org logo
Title
l

Landry Norris

06/02/2022, 6:52 PM
I recently ran into this error when running compileIosMainKotlinMetadata
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

Arkadii Ivanov

06/02/2022, 7:07 PM
It looks like your module depends on another module containing
TrimComponent
. You should also add
decompose
as a dependency.
l

Landry Norris

06/02/2022, 7:27 PM
I have this line in the commonMain dependencies block of my build.gradle.kts
implementation("com.arkivanov.decompose:decompose:0.6.0")
a

Arkadii Ivanov

06/02/2022, 7:36 PM
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

Landry Norris

06/02/2022, 7:40 PM
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

Arkadii Ivanov

06/02/2022, 7:43 PM
Thanks!
l

Landry Norris

06/06/2022, 2:08 PM
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

Arkadii Ivanov

06/06/2022, 2:11 PM
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

Landry Norris

06/06/2022, 4:00 PM
I’m using 1.6.21 and for Compose, I’m using compose-jb 1.2.0-alpha01-dev686
a

Arkadii Ivanov

06/06/2022, 4:03 PM
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

Landry Norris

06/06/2022, 4:53 PM
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

Arkadii Ivanov

06/06/2022, 6:13 PM
Yeah! Compose for iOS is not quite ready yet.
l

Landry Norris

06/17/2022, 4:25 PM
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.
:kotlin-intensifies: 1