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

Andrey

03/31/2023, 10:19 AM
Hello, I've encountered a strange work of exceptions in kotlin. This is only playable with the armeabi-v7a architecture and only on real devices.I can reproduce this with these settings.
Copy code
kotlin {

    androidNativeArm32().binaries.sharedLib()
 
    sourceSets {

        val commonMain by sourceSets.getting {
            dependencies {

            }
        }

        val androidNativeArm32Main by getting

        val androidNativeMain by creating {

            androidNativeArm32Main.dependsOn(this)
            dependsOn(commonMain)
        }
    }
}
Copy code
fun load() {
    var test = Exception()
    return
}
And it's enough to create/throw any exception. Then the thread starts to run endlessly, consuming about 12% of RAM and CPU Nowhere except the real device, this problem is not reproduced. There are no exceptions or any entries in the log file either. Please Any ideas how can I get around this
😲 2
Most likely it's all somehow related to the thread deadlock. As described in this article https://habr.com/ru/company/dododev/blog/541650/
All this can be bypassed by wrapping the code with any coroutine, but the problem is that I need to call JNI , and Dispatchers.Main is not implemented in android
6 Views