Kotlin / multik

Multidimensional array library for Kotlin
https://kotlin.github.io/multik/
Apache License 2.0
633 stars 38 forks source link

combination of android sharedUserId and multik leading to crashes #203

Open meedovique opened 3 months ago

meedovique commented 3 months ago

Hi, there is some weird error when using android:sharedUserId="android.uid.system" and importing multik-core + multik-kotlin

Exception in runtime when using .dot

Caused by java.lang.IllegalStateException: Fail to find engine. Consider to add one of the following dependencies: 
 - multik-default
 - multik-kotlin
 - multik-openblas
       at org.jetbrains.kotlinx.multik.api.EngineKt.enginesProvider(Engine.kt:13)
       at org.jetbrains.kotlinx.multik.api.Engine.<clinit>(Engine.kt:68)
       at org.jetbrains.kotlinx.multik.api.Multik.getLinalg(Multik.kt:49)
       at org.jetbrains.kotlinx.multik.api.linalg._linalgKt.dotDefMMNumber(_linalg.kt:21)
       ...

found in both version 0.2.2 and version 0.2.3, happens with sample android project adding just uid + signingConfigs and multik

what do you think could be the cause of such an error?

devcrocod commented 3 months ago

Try specifying the dependency directly: multik-kotlin-jvm

I'm not sure what could be causing this error. There are plans to improve android support in the next release

meedovique commented 3 months ago

i tried add jar files:

  implementation(files("libs/multik-core-jvm-0.2.3.jar"))
  implementation(files("libs/multik-kotlin-jvm-0.2.3.jar"))

that didn't work either

devcrocod commented 3 months ago

you don't need to add jar locally in this case transitive dependencies may not work

To add, use the regular mechanism:

  implementation("org.jetbrains.kotlinx:multik-core-jvm:0.2.3")
  implementation("org.jetbrains.kotlinx:multik-kotlin-jvm:0.2.3")

For some reason, the ServiceProvider doesn't work as a workaround, you can call dot directly:

KELinAlg.dot(...)