dkurt / openvino_java

Build, package and publish OpenVINO for Java
Apache License 2.0
12 stars 10 forks source link

java.lang.UnsatisfiedLinkError #27

Closed mohanadHamed closed 10 months ago

mohanadHamed commented 10 months ago

After adding the release file openvino-2023.0-android-arm64-v8a.aar to my android studio project, I get the following runtime error when the execution reaches the line org.intel.openvino.Core core = new org.intel.openvino.Core(); :

FATAL EXCEPTION: main Process: com.example.livestreamdetection, PID: 9137 java.lang.UnsatisfiedLinkError: No implementation found for long org.intel.openvino.Core.GetCore() (tried Java_org_intel_openvino_Core_GetCore and Java_org_intel_openvino_Core_GetCore__) at org.intel.openvino.Core.GetCore(Native Method) at org.intel.openvino.Core.(Core.java:28) at com.example.livestreamdetection.FrameProcessor.(FrameProcessor.java:54) at com.example.livestreamdetection.MainActivity.processNetwork(MainActivity.java:64) at com.example.livestreamdetection.MainActivity.onCreate(MainActivity.java:100) at android.app.Activity.performCreate(Activity.java:7343) at android.app.Activity.performCreate(Activity.java:7333) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1219) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3271) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3429) at android.app.ActivityThread.-wrap12(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009) at android.os.Handler.dispatchMessage(Handler.java:109) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7555) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)

Any clue how to fix? Thanks.

mohanadHamed commented 10 months ago

The issue has been fixed by loading native inference engine library at application start:

    protected void onCreate(Bundle savedInstanceState) {

        .
        .
        .
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        .
        .
        .
    }