tensorflow: UnsatisfiedLinkError: Failed to load native TensorFlow Lite methods

Click to expand!

Issue Type

Bug

Have you reproduced the bug with TF nightly?

Yes

Source

binary

Tensorflow Version

0.0.0-nightly-SNAPSHOT

Custom Code

No

OS Platform and Distribution

No response

Mobile device

Android Samsung Galaxy J5

Python version

No response

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

Fatal Exception: java.lang.UnsatisfiedLinkError: Failed to load native TensorFlow Lite methods. Check that the correct native libraries are present, and, if using a custom native library, have been properly loaded via System.loadLibrary(): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol “__register_atfork” referenced by “libtensorflowlite_jni.so”

This is reproducible on lot of android devices running android version 5,6,7 This is happening in the nightly snapshots from probably last 2 weeks. Did not encounter this in previous nightly snapshots.

Standalone code to reproduce the issue

val nnApiOption = NnApiDelegate.Options()
nnApiOption.setUseNnapiCpu(true)
val nnApiDelegate = NnApiDelegate(nnApiOption)

Relevant log output

2023-06-28 10:52:35.629 29536-29620 InterpreterApi I Didn’t load native library: tensorflowlite_jni 2023-06-28 10:52:35.637 29536-29620 InterpreterApi I Didn’t load native library: tensorflowlite_jni_stable 2023-06-28 10:52:35.638 29536-29620 InterpreterApi I Didn’t load native library: tensorflowlite_jni_gms_client

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (1 by maintainers)

Most upvoted comments

This is also happening with the code from docs https://www.tensorflow.org/lite/android/delegates/nnapi Able to replicate in android 5,6,7 bunch of devices

Interpreter.Options options = (new Interpreter.Options());
NnApiDelegate nnApiDelegate = null;
// Initialize interpreter with NNAPI delegate for Android Pie or above
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
    nnApiDelegate = new NnApiDelegate();
    options.addDelegate(nnApiDelegate);
}

I think this is an issue with interpreter rather nnapi

@pjpratik I am able to replicate this with latest version as well. org.tensorflow:tensorflow-lite:2.12.0