flutter_tflite_audio icon indicating copy to clipboard operation
flutter_tflite_audio copied to clipboard

Crash on android Emulator for Google's Teachable Machine

Open Caldarie opened this issue 3 years ago • 8 comments

Let me explain you what's happening, when running the app, the debug session is starting, everything is okay, then, at the moment when the app is loading and opening on the android emulator, it's freezing and closing directly. Then you have : 'lost connection to device'

Crash Report:

` /Tflite_audio( 5403): loadModel D/Tflite_audio( 5403): model name is: assets/google_teach_machine_model.tflite I/tflite ( 5403): Initialized TensorFlow Lite runtime. W/native ( 5403): cpu_feature_guard.cc:36 The TensorFlow library was compiled to use SSE instructions, but these aren't available on your machine. F/libc ( 5403): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xfffffff4 in tid 5403 (e_audio_example), pid 5403 (e_audio_example)


Build fingerprint: 'google/sdk_gphone_x86_arm/generic_x86_arm:11/RSR1.201013.001/6903271:userdebug/dev-keys' Revision: '0' ABI: 'x86' Timestamp: 2021-02-18 08:51:25+0100 pid: 5403, tid: 5403, name: e_audio_example >>> tfliteaudio.tflite_audio_example <<< uid: 10153 signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xfffffff4 eax 00000000 ebx abdaeff4 ecx 000000a0 edx 0000000d edi e85140e8 esi abdb85f8 ebp ff9f37b8 esp ff9f3770 eip a6f9bd29 backtrace: #00 pc 0039ad29 /data/app/~~1HiIG67KtPY_A-PHL0219w==/tfliteaudio.tflite_audio_example-zsfQjns-rATmoaLaZf6gUw==/lib/x86/libtensorflowlite_flex_jni.so #01 pc 046f57e7 /data/app/~~1HiIG67KtPY_A-PHL0219w==/tfliteaudio.tflite_audio_example-zsfQjns-rATmoaLaZf6gUw==/lib/x86/libtensorflowlite_flex_jni.so #02 pc 046f5462 /data/app/~~1HiIG67KtPY_A-PHL0219w==/tfliteaudio.tflite_audio_example-zsfQjns-rATmoaLaZf6gUw==/lib/x86/libtensorflowlite_flex_jni.so #03 pc 046f5a6b /data/app/~~1HiIG67KtPY_A-PHL0219w==/tfliteaudio.tflite_audio_example-zsfQjns-rATmoaLaZf6gUw==/lib/x86/libtensorflowlite_flex_jni.so #04 pc 04521527 /data/app/~~1HiIG67KtPY_A-PHL0219w==/tfliteaudio.tflite_audio_example-zsfQjns-rATmoaLaZf6gUw==/lib/x86/libtensorflowlite_flex_jni.so #05 pc 00397b75 /data/app/~~1HiIG67KtPY_A-PHL0219w==/tfliteaudio.tflite_audio_example-zsfQjns-rATmoaLaZf6gUw==/lib/x86/libtensorflowlite_flex_jni.so #06 pc 0005f918 /apex/com.android.runtime/bin/linker (_dl__ZL10call_arrayIPFviPPcS1_EEvPKcPT_jbS5+312) (BuildId: c17fda87f98636d6da3d69604bb1486c) #07 pc 0005fbbc /apex/com.android.runtime/bin/linker (__dl__ZN6soinfo17call_constructorsEv+588) (BuildId: c17fda87f98636d6da3d69604bb1486c) #08 pc 00043be2 /apex/com.android.runtime/bin/linker (__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv+2674) (BuildId: c17fda87f98636d6da3d69604bb1486c) #09 pc 0003e4b2 /apex/com.android.runtime/bin/linker (__dl__ZL10dlopen_extPKciPK17android_dl

#145 pc 0036fb02 /apex/com.android.art/lib/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16375758241455872412)+370) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #146 pc 00379b00 /apex/com.android.art/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+176) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #147 pc 0078b325 /apex/com.android.art/lib/libart.so (artQuickToInterpreterBridge+1061) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #148 pc 0014220d /apex/com.android.art/lib/libart.so (art_quick_to_interpreter_bridge+77) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #149 pc 00893656 /system/framework/x86/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2102) (BuildId: 9a9778e61b43d349325d0bb85244bd9bc95ff387) #150 pc 0013baf2 /apex/com.android.art/lib/libart.so (art_quick_invoke_static_stub+418) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #151 pc 001d0392 /apex/com.android.art/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+258) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #152 pc 0062e653 /apex/com.android.art/lib/libart.so (art::JValue art::InvokeWithVarArgsart::ArtMethod*(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, char*)+579) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #153 pc 0062eb25 /apex/com.android.art/lib/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, char*)+85) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #154 pc 004ce64f /apex/com.android.art/lib/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+735) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #155 pc 003f8aae /apex/com.android.art/lib/libart.so (art::(anonymous namespace)::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, char*, art::Primitive::Type, art::InvokeType)+2846) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #156 pc 003e60d9 /apex/com.android.art/lib/libart.so (art::(anonymous namespace)::CheckJNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+73) (BuildId: 8191579dfafff37a5cbca70f9a73020f) #157 pc 0008f90e /system/lib/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+62) (BuildId: 588f2cd5873ff4273bb25b25edb82606) #158 pc 00098c8e /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vectorandroid::String8 const&, bool)+910) (BuildId: 588f2cd5873ff4273bb25b25edb82606) #159 pc 00003804 /system/bin/app_process32 (main+1588) (BuildId: c5eedbfb6130af84c3db8e121fb1202e) #160 pc 000522e3 /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+115) (BuildId: 6e3a0180fa6637b68c0d181c343e6806) Lost connection to device. ` Screenshot 2021-02-18 at 08 49 36

Originally posted by @Tanelo in https://github.com/Caldarie/flutter_tflite_audio/issues/4#issuecomment-781130324

Caldarie avatar Feb 18 '21 11:02 Caldarie

Hi @Tanelo,

I have found the reason for your issue.

Are you running the example on an emulator? It seems like this package is no longer compatible on android emulators.

Do you have an android device by any chance? if yes, can you run it on that device in the meantime?

When i have time, I will provide an update.

Caldarie avatar Feb 18 '21 11:02 Caldarie

Hi @Caldarie, i will ! Thanks. That would be dope if you'd provide an update !

Tanelo avatar Feb 18 '21 11:02 Tanelo

I had the same problem before I run in a physical device and after some research I think it is an architecture incompatibility with your emulator.

cmalbuquerque avatar Feb 18 '21 11:02 cmalbuquerque

@cmalbuquerque Many thanks for letting me know.

Yeah, it may seem so. Technology does change fast. Haha!

Caldarie avatar Feb 18 '21 11:02 Caldarie

Even on physical device I still have this error (both on simulator and on device): error: package org.tensorflow.lite does not exist Even though it works on ios device now.

pierremotard avatar Feb 18 '21 17:02 pierremotard

@pierremotard can you provide a full log please?

Caldarie avatar Feb 18 '21 20:02 Caldarie

Here is the full log, running on Samsung S10

/Users/pierre/code/audio_tflite/android/src/main/java/flutter/tflite_audio/TfliteAudioPlugin.java:24: error: package org.tensorflow.lite does not exist import org.tensorflow.lite.Interpreter; ^ /Users/pierre/code/audio_tflite/android/src/main/java/flutter/tflite_audio/TfliteAudioPlugin.java:91: error: cannot find symbol private Interpreter tfLite; ^ symbol: class Interpreter location: class TfliteAudioPlugin /Users/pierre/code/audio_tflite/android/src/main/java/flutter/tflite_audio/TfliteAudioPlugin.java:180: error: package Interpreter does not exist final Interpreter.Options tfliteOptions = new Interpreter.Options(); ^ /Users/pierre/code/audio_tflite/android/src/main/java/flutter/tflite_audio/TfliteAudioPlugin.java:180: error: package Interpreter does not exist final Interpreter.Options tfliteOptions = new Interpreter.Options(); ^ /Users/pierre/code/audio_tflite/android/src/main/java/flutter/tflite_audio/TfliteAudioPlugin.java:182: error: cannot find symbol tfLite = new Interpreter(buffer, tfliteOptions); ^ symbol: class Interpreter location: class TfliteAudioPlugin Note: /Users/pierre/code/audio_tflite/android/src/main/java/flutter/tflite_audio/TfliteAudioPlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 5 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':tflite_audio:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 25s Exception: Gradle task assembleDebug failed with exit code 1

pierremotard avatar Feb 28 '21 19:02 pierremotard

@pierremotard When you run the example given in this repository, do you still get the same error?

Caldarie avatar Mar 01 '21 15:03 Caldarie