Hey guys, what is a possible reason of this build...
# multiplatform
r
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
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
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
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
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
Understand your frustration, but I believe this tools are going to be improved over time.
j
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
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
I the build task succeeds after downgrading to 1.2.2. I will create an issue in youtrack for that