Hey there!
I am currently building an Compose Multiplatform app that utilizes an MQTT client to pull some data and display it in a pretty way. Since the library (KMQTT,
https://github.com/davidepianca98/KMQTT) has very little documentation, I wanted to simply play around with it and test it. When I try to run my code on Android however, the App immediately crashes, as I encounter an
android.os.NetworkOnMainThreadException
error. All online suggestions I have found to fix this issue use the
thread { }
block in some capacity - as far as I know, I cannot use threads in my multiplatform project, as this block from the Kotlin standard library is only supported for JVM targets. Since I am new to App development
and Android app development
and Kotlin
and KMP, I for sure cannot rule out that I am just doing something wrong. Has anyone here used that library before and is able to help me out here?
Thanks!