What did I do?
- Added dependencies under
build.gradle
implementation "io.ktor:ktor:1.3.2"
implementation "io.ktor:ktor-server-netty:1.3.2"
implementation "io.ktor:ktor-gson:1.3.2"
AndroidMenifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
embeddedServer(Netty, 9000) {
install(ContentNegotiation) {
gson {}
}
routing {
get("/") {
call.respond(mapOf("message" to "Hello world"))
}
}
}.start(wait = true)
}
}
What went wrong?
Upon running app, I get following errors & android local server isn't starting.
No implementation found for int io.netty.channel.kqueue.Native.sizeofKEvent()
(tried Java_io_netty_channel_kqueue_Native_sizeofKEvent
and Java_io_netty_channel_kqueue_Native_sizeofKEvent__)
No implementation found for int io.netty.channel.epoll.Native.offsetofEpollData()
(tried Java_io_netty_channel_epoll_Native_offsetofEpollData
and Java_io_netty_channel_epoll_Native_offsetofEpollData__)
Jetty
orCIO
– Trimly