5

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)
4

3 回答 3

3

按照 Dharma 的解决方法,我改变了:

从:

编译 'org.tensorflow:tensorflow-lite:+'

至:

编译 'org.tensorflow:tensorflow-lite:0.1'

但是由于 Gradle 错误,该项目无法构建。在 Android Studio 中,我做了以下事情:

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

Android Studio 项目设置截图

这些设置基于列出所有正确组合的以下文档:
插件和 Gradle 版本表

使用这些设置,我能够毫无问题地构建和运行示例项目......

于 2018-04-13T10:46:35.170 回答
1

@Jin Yifei,我也遇到了同样的问题。我可以通过将 tensorflow-lite 版本回滚到0.1. 据我所知,演示似乎与0.1.1(目前是最新的)不兼容。

您可以通过更改来做到这一点app/build.gradle

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

对此:

compile 'org.tensorflow:tensorflow-lite:0.1'
于 2018-04-06T12:20:45.867 回答
0

就我而言,这是因为我选择了 abifilters 作为 armeabi :

defaultConfig {
        ndk {
            abiFilters 'armeabi'        }
    }

.但是TFLite官说TFLite只支持armeabi-v7a和arm64-v8a。

于 2019-12-28T03:31:51.263 回答