Jin Yifei
Jin Yifei

Reputation: 63

UnsatisfiedLinkError while building Tensorflow Lite demo source code

I am using Android Studio 3.0.3 with Gradle 3.3 and I was trying to build:

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/java/demo

But I was troubled by this issue:

java.lang.UnsatisfiedLinkError: No implementation found for long org.tensorflow.lite.NativeInterpreterWrapper.createErrorReporter(int) (tried Java_org_tensorflow_lite_NativeInterpreterWrapper_createErrorReporter and Java_org_tensorflow_lite_NativeInterpreterWrapper_createErrorReporter__I)
 at org.tensorflow.lite.NativeInterpreterWrapper.createErrorReporter(Native Method)
 at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:47)
 at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:77)
 at com.example.android.tflitecamerademo.ImageClassifier.<init>(ImageClassifier.java:94)
 at com.example.android.tflitecamerademo.Camera2BasicFragment.onActivityCreated(Camera2BasicFragment.java:299)
 at android.app.Fragment.performActivityCreated(Fragment.java:2620)
 at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1296)

Upvotes: 6

Views: 3023

Answers (3)

Wade Wang
Wade Wang

Reputation: 690

In my case,it's because i choose the abifilters as armeabi :

defaultConfig {
        ndk {
            abiFilters 'armeabi'        }
    }

.But the TFLite official website says TFLite only support armeabi-v7a and arm64-v8a.

Upvotes: 0

Elletlar
Elletlar

Reputation: 3234

Following Dharma's workaround, I changed:

From:

compile 'org.tensorflow:tensorflow-lite:+'

To:

compile 'org.tensorflow:tensorflow-lite:0.1'

But the project would not build due to Gradle errors. In Android studio, I did the following:

File -> Project Settings -> Project

From:
Gradle Version: 4.4, Android Plugin Version: 3.1.0

To:
Gradle Version: 4.1, Android Plugin Version: 3.0.0

Screenshot of Android Studio Project Settings

Those settings are based on the following document that lists all the correct combinations:
Table of Plugin & Gradle Versions

With these settings, I'm able to build and run the sample projects without any problems...

Upvotes: 3

Sai&#39;s Stack
Sai&#39;s Stack

Reputation: 1385

@Jin Yifei, I also ran into this same problem. I was able to work around it by rolling back the tensorflow-lite version to 0.1. As far as I can tell the demo doesn't seem to be compatible with 0.1.1 (which is currently the latest).

You can do so by changing app/build.gradle from :

compile 'org.tensorflow:tensorflow-lite:+'

to this :

compile 'org.tensorflow:tensorflow-lite:0.1'

Upvotes: 1

Related Questions