Multiplatform Project: iOS and Android cannot import ktor in SharedCode module

I’m following this
Its about Multiplatform Project: iOS and Android

In side the SharedCode module, I’m not able to import java.
In the app module, I’m able to import java. The JDK location had been provided in project structure, shown in screenshot below. What am I missing?

You cannot use Java code inside the iOS source set (iosMain), the only place where you could use Java code (in your case) is in the Android source set (androidMain), everywhere else you can only use Kotlin

I’m trying test a http request.
URL provided here
It doesn’t allow me to add dependencies in the SharedCode Build.gradle.
Any workaround so the iosMain can have more functions to use?


That class is only available for JavaScript targets.

If you want to use something in iOS you need to look for classes that are available either in Common or in Native (blue dot or purple dot respectively)

Now, for making HTTP requests you could use Ktor (

Following this example:
I have added the suggested implementation to Build.gradle for SharedCode… Only the one for Android works.
Import io.ktor in the android main is ok.
For common and iosMain does not work. Please see screenshots.


I found these examples but there is no example showing what I’m trying to do.

:thinking: Now I don’t really know why it isn’t working.