1

I am trying to integrate the openblas preset of javacpp into my Android application. I have created a test app to illustrate my problem available in Github. The app simply runs the example code from https://github.com/bytedeco/javacpp-presets/tree/master/openblas inside the MainActivity.onCreate() method.

My gradle build dependencies are as follows:

compile 'org.bytedeco:javacpp:1.3.2'
compile 'org.bytedeco.javacpp-presets:openblas:0.2.19-1.3'
compile group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.2.19-1.3', classifier: 'android-x86'
compile group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.2.19-1.3', classifier: 'android-arm'

When I run the app in the emulator I get:

     java.lang.UnsatisfiedLinkError: No implementation found for int org.bytedeco.javacpp.openblas.LAPACKE_dgels(int, byte, int, int, int, double[], int, double[], int) (tried Java_org_bytedeco_javacpp_openblas_LAPACKE_1dgels and Java_org_bytedeco_javacpp_openblas_LAPACKE_1dgels__IBIII_3DI_3DI)
      at org.bytedeco.javacpp.openblas.LAPACKE_dgels(Native Method)
      at org.androidopenblas.ExampleDGELSrowmajor.runExample(MainActivity.java:80)
      at org.androidopenblas.MainActivity.onCreate(MainActivity.java:19)
      ...

Am I missing some dependencies?

jadarve
  • 309
  • 3
  • 7

1 Answers1

0

I am not too familiar with the Maven way of doing things, and could not reproduce the error.

The error suggests that Android tries to locate a JNI exported c++ function that is not linked.

But if I simple create your project in Android Studio, I got a linker error: 'e/linker: library "/system/lib/libdl.so"'. This was due to Android not locating jniopenblas.so at runtime.

If I extract the libjniopenblas.so and libopenblas.so and explicitly put them in app/main/jniLibs/armeabi-v7a/ (created the dir) and add specified abiFilters: 'armeabi-v7a'to the [app]build.gradle, the error resolves and the project compiles and runs.

So maybe - Android is unable to locate the static libraries inside openblas-android-arm.jar?

Paamand
  • 626
  • 1
  • 6
  • 17