https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

Radoslaw Juszczyk

01/10/2022, 12:19 PM
Hey guys, what is a possible reason of this build failure?
Copy code
e: Compilation failed: null

 * Source files: 
 * Compiler version info: Konan: 1.6.10 / Kotlin: 1.6.10
 * Output kind: FRAMEWORK

e: java.lang.NullPointerException
	at org.jetbrains.kotlin.backend.konan.optimizations.DataFlowIR$SymbolTable.mapClassReferenceType(DataFlowIR.kt:520) ...
I got it when trying to execute linkMultiplatformAppReleaseFrameworkIosArm64 gradle task
k

Karel Petránek

01/10/2022, 1:38 PM
Hard to tell just from this stacktrace. There is something in your code that triggers this failure - possibly even a bug in the compiler. To investigate these issues, I usually run the gradle task in debug mode, set exception breakpoint to NullPointerException and set the compiler to run within the gradle process. Then you can investigate the local variables to see whether they point you to the source potentially causing this.
r

Radoslaw Juszczyk

01/10/2022, 2:58 PM
I noticed that if I have both
Copy code
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlin_serialization")
and
Copy code
implementation("io.ktor:ktor-client-serialization:$ktor")
in my commonMain then it fails with that exception
k

Karel Petránek

01/10/2022, 3:05 PM
could be that ktor is using a different version of kotlinx.serialization than the version you are using and this conflict manifests in missing symbols during the linking phase
I would expect this to error our earlier but I’d try to align the versions to see if that helps
👍 1
r

Radoslaw Juszczyk

01/10/2022, 3:10 PM
after checking with
./gradlew dependencies
it turns out that the one in ktor is of version 1.2.2 and the one i am importing is 1.3.2 I will try to downgrade mine for a test
yeah it works now, that was it. but finding it would be a nightmare especially if there were two conflicting libraries. Everytime I have such a cryptic error in my kmp project I go through a process of creating a new project and copying pieces of my project to it until it starts failing.
a

Anton Afanasev

01/10/2022, 3:46 PM
Understand your frustration, but I believe this tools are going to be improved over time.
j

jean

01/27/2022, 2:15 PM
I just got the exact same issue. It’s weird that it was not complaining about this version conflict while I was using kotlin
1.5.31
.
r

Radoslaw Juszczyk

01/27/2022, 2:19 PM
Did you manage to fix it ? Looks like some of the dependencies depends on older version of kotlin where there were symbols which are no longer available in the newer versions
j

jean

01/27/2022, 2:31 PM
I the build task succeeds after downgrading to 1.2.2. I will create an issue in youtrack for that