cameraExample, openCVExample crash on startup

Hi, this are my data:

pc: linux mint qiana (base repos ubuntu trusty) 32 bit
tablet: google nexus 7 with android vers. 4.3.1

adt-bundle-linux-x86-20140702
of_v0.8.3_android_release
android-ndk-r9b (I’ve also tried ndk r10)

The problem is that cameraExample, openCVExample, openCVFaceExample are crashing when starting on tablet…I thought maybe is related to the camera…becouse I’ve an app called phonopaper which crashes the same way…and I know that this app is built in c++…so probably with ndk…and uses camera…but the developer said that doesn’t crashes on all devices.

Also I’ve notice that most of the examples are crashing when switching to another app and then coming back…or resuming from sleep.

Is there a way to solve this issues?

I just tried on my Nexus 7 and the openCVExample runs @ 60 fps.

Can you dump the Logcat of your crash to a gist?

hi…thank you for your reply:

08-21 19:26:01.219: I/OF(16543): static init
08-21 19:26:01.229: I/OF(16543): failed neon detection, loading not-neon library
08-21 19:26:01.229: I/OF(16543): java.lang.UnsatisfiedLinkError: Couldn't load neondetection from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/cc.openframeworks.androidOpenCVExample-2.apk"],nativeLibraryDirectories=[/data/app-lib/cc.openframeworks.androidOpenCVExample-2, /vendor/lib, /system/lib]]]: findLibrary returned null
08-21 19:26:01.229: I/OF(16543): 	at java.lang.Runtime.loadLibrary(Runtime.java:355)
08-21 19:26:01.229: I/OF(16543): 	at java.lang.System.loadLibrary(System.java:525)
08-21 19:26:01.229: I/OF(16543): 	at cc.openframeworks.OFAndroid.<clinit>(OFAndroid.java:1023)
08-21 19:26:01.229: I/OF(16543): 	at cc.openframeworks.androidOpenCVExample.OFActivity.onCreate(OFActivity.java:18)
08-21 19:26:01.229: I/OF(16543): 	at android.app.Activity.performCreate(Activity.java:5133)
08-21 19:26:01.229: I/OF(16543): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
08-21 19:26:01.229: I/OF(16543): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2293)
08-21 19:26:01.229: I/OF(16543): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389)
08-21 19:26:01.229: I/OF(16543): 	at android.app.ActivityThread.access$600(ActivityThread.java:153)
08-21 19:26:01.229: I/OF(16543): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269)
08-21 19:26:01.229: I/OF(16543): 	at android.os.Handler.dispatchMessage(Handler.java:99)
08-21 19:26:01.229: I/OF(16543): 	at android.os.Looper.loop(Looper.java:137)
08-21 19:26:01.229: I/OF(16543): 	at android.app.ActivityThread.main(ActivityThread.java:5289)
08-21 19:26:01.229: I/OF(16543): 	at java.lang.reflect.Method.invokeNative(Native Method)
08-21 19:26:01.229: I/OF(16543): 	at java.lang.reflect.Method.invoke(Method.java:525)
08-21 19:26:01.229: I/OF(16543): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
08-21 19:26:01.229: I/OF(16543): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
08-21 19:26:01.229: I/OF(16543): 	at dalvik.system.NativeStart.main(Native Method)
08-21 19:26:01.229: D/dalvikvm(16543): Trying to load lib /data/app-lib/cc.openframeworks.androidOpenCVExample-2/libOFAndroidApp.so 0x41a7be68
08-21 19:26:01.279: D/dalvikvm(16543): Added shared lib /data/app-lib/cc.openframeworks.androidOpenCVExample-2/libOFAndroidApp.so 0x41a7be68
08-21 19:26:01.279: I/(16543): JNI_OnLoad called
08-21 19:26:01.279: I/OF(16543): initializing app
08-21 19:26:01.279: I/OF(16543): OFAndroid init...
08-21 19:26:01.279: I/OF(16543): starting resources extractor
08-21 19:26:01.289: I/OF(16543): sd mounted: true
08-21 19:26:01.289: I/OF(16543): joining
08-21 19:26:01.289: I/OF(16543): creating app directory: /storage/emulated/0/Android/data/cc.openframeworks.androidOpenCVExample/files
08-21 19:26:01.289: I/ofAppAndroidWindow(16543): setting app dir name to: "/storage/emulated/0/Android/data/cc.openframeworks.androidOpenCVExample/files"
08-21 19:26:01.289: I/OF(16543): app name: androidopencvexample
08-21 19:26:01.289: I/OF(16543): joined
08-21 19:26:01.349: V/OF(16543): trying to find class: cc.openframeworks.androidOpenCVExample.R$layout
08-21 19:26:01.349: I/OF(16543): onResume
08-21 19:26:01.389: D/libEGL(16543): loaded /system/lib/egl/libEGL_tegra.so
08-21 19:26:01.399: D/libEGL(16543): loaded /system/lib/egl/libGLESv1_CM_tegra.so
08-21 19:26:01.409: D/libEGL(16543): loaded /system/lib/egl/libGLESv2_tegra.so
08-21 19:26:01.469: D/OpenGLRenderer(16543): Enabling debug mode 0
08-21 19:26:01.509: I/OF(16543): onSurfaceCreated
08-21 19:26:01.519: I/ofAppAndroidWindow(16543): setup
08-21 19:26:01.639: I/(16543): initializing camera with external texture
08-21 19:26:01.649: E/OF(16543): Error initializing gl surface
08-21 19:26:01.649: E/OF(16543): java.lang.NullPointerException
08-21 19:26:01.649: E/OF(16543): 	at cc.openframeworks.OFAndroidVideoGrabber.setTexture(OFAndroidVideoGrabber.java:62)
08-21 19:26:01.649: E/OF(16543): 	at cc.openframeworks.OFAndroidVideoGrabber.initGrabber(OFAndroidVideoGrabber.java:99)
08-21 19:26:01.649: E/OF(16543): 	at cc.openframeworks.OFAndroid.setup(Native Method)
08-21 19:26:01.649: E/OF(16543): 	at cc.openframeworks.OFAndroidWindow.setup(OFAndroidWindow.java:290)
08-21 19:26:01.649: E/OF(16543): 	at cc.openframeworks.OFAndroidWindow.onSurfaceChanged(OFAndroidWindow.java:282)
08-21 19:26:01.649: E/OF(16543): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1514)
08-21 19:26:01.649: E/OF(16543): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1242)
08-21 19:26:01.689: W/dalvikvm(16543): threadid=11: thread exiting with uncaught exception (group=0x417fa7c0)
08-21 19:26:01.689: E/AndroidRuntime(16543): FATAL EXCEPTION: GLThread 1634
08-21 19:26:01.689: E/AndroidRuntime(16543): java.lang.NullPointerException
08-21 19:26:01.689: E/AndroidRuntime(16543): 	at cc.openframeworks.OFAndroidVideoGrabber.initGrabber(OFAndroidVideoGrabber.java:101)
08-21 19:26:01.689: E/AndroidRuntime(16543): 	at cc.openframeworks.OFAndroid.setup(Native Method)
08-21 19:26:01.689: E/AndroidRuntime(16543): 	at cc.openframeworks.OFAndroidWindow.setup(OFAndroidWindow.java:290)
08-21 19:26:01.689: E/AndroidRuntime(16543): 	at cc.openframeworks.OFAndroidWindow.onSurfaceChanged(OFAndroidWindow.java:282)
08-21 19:26:01.689: E/AndroidRuntime(16543): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1514)
08-21 19:26:01.689: E/AndroidRuntime(16543): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1242)
08-21 19:26:01.719: I/ofAppAndroidWindow(16543): onSurfaceDestroyed
08-21 19:26:01.829: I/OF(16543): onPause

run a clean and recompile everything.

Ok…I’ve done a clean all and rebuilt all…but the situation is unchanged…the logcat looks the same as before…
After rebuilding all I have 70 warnings:

Description    Resource    Path    Location    Type
The method setPreviewFrameRate(int) from the type Camera.Parameters is deprecated    OFAndroidVideoGrabber.java    /ofAndroidLib/src/cc/openframeworks    line 142    Java Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
The import android.graphics.SurfaceTexture is never used    OFAndroidVideoGrabber.java    /ofAndroidLib/src/cc/openframeworks    line 14    Java Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
The method getSupportedPreviewFrameRates() from the type Camera.Parameters is deprecated    OFAndroidVideoGrabber.java    /ofAndroidLib/src/cc/openframeworks    line 114    Java Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
variable 'isVBOSupported' set but not used [-Wunused-but-set-variable]    android3DModelLoaderExample        line 61    C/C++ Problem
The method getAvailableBlocks() from the type StatFs is deprecated    OFAndroid.java    /ofAndroidLib/src/cc/openframeworks    line 228    Java Problem
The import java.lang.reflect.InvocationTargetException is never used    OFAndroidVideoGrabber.java    /ofAndroidLib/src/cc/openframeworks    line 5    Java Problem
The method getBlockSize() from the type StatFs is deprecated    OFAndroid.java    /ofAndroidLib/src/cc/openframeworks    line 229    Java Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
The import android.annotation.SuppressLint is never used    OFAndroidVideoGrabber.java    /ofAndroidLib/src/cc/openframeworks    line 11    Java Problem
unused variable 'texcoordIndex' [-Wunused-variable]    android3DModelLoaderExample        line 507    C/C++ Problem
unused variable 'vertexIndex' [-Wunused-variable]    android3DModelLoaderExample        line 507    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
variable 'isVBOSupported' set but not used [-Wunused-but-set-variable]    android3DModelLoaderExample        line 61    C/C++ Problem
The value of the local variable field is not used    OFAndroid.java    /ofAndroidLib/src/cc/openframeworks    line 480    Java Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
unused variable 'vertexIndex' [-Wunused-variable]    android3DModelLoaderExample        line 507    C/C++ Problem
variable 'isVBOSupported' set but not used [-Wunused-but-set-variable]    android3DModelLoaderExample        line 61    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
unused variable 'texcoordIndex' [-Wunused-variable]    android3DModelLoaderExample        line 507    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
variable 'isVBOSupported' set but not used [-Wunused-but-set-variable]    android3DModelLoaderExample        line 61    C/C++ Problem
unused variable 'vertexIndex' [-Wunused-variable]    android3DModelLoaderExample        line 507    C/C++ Problem
unused variable 'vertexIndex' [-Wunused-variable]    android3DModelLoaderExample        line 507    C/C++ Problem
unused variable 'texcoordIndex' [-Wunused-variable]    android3DModelLoaderExample        line 507    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
typedef 'ElementType' locally defined but not used [-Wunused-local-typedefs]    androidOpenCVFaceExample        line 45    C/C++ Problem
unused variable 'texcoordIndex' [-Wunused-variable]    android3DModelLoaderExample        line 507    C/C++ Problem
typedef 'ElementType' locally defined but not used [-Wunused-local-typedefs]    androidOpenCVFaceExample        line 45    C/C++ Problem
comparison between signed and unsigned integer expressions [-Wsign-compare]    ofApp.cpp    /androidOpenCVFaceExample/src    line 54    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::dir' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::pos' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::dir' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::pos' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::dir' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
comparison between signed and unsigned integer expressions [-Wsign-compare]    androidAssimpExample        line 227    C/C++ Problem
'void ofxAssimpModelLoader::setAnimation(int)' is deprecated (declared at ../../../addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp:521): Use ofxAssimpAnimation instead [-Wdeprecated-declarations]    androidAssimpExample        line 533    C/C++ Problem
'void ofxAssimpModelLoader::setTime(float)' is deprecated (declared at ../../../addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.h:50): Use ofxAssimpAnimation instead [-Wdeprecated-declarations]    androidAssimpExample        line 536    C/C++ Problem
'void ofxAssimpModelLoader::setAnimation(int)' is deprecated (declared at ../../../addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp:521): Use ofxAssimpAnimation instead [-Wdeprecated-declarations]    androidAssimpExample        line 544    C/C++ Problem
narrowing conversion of 'ofGetHeight()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 63    C/C++ Problem
comparison between signed and unsigned integer expressions [-Wsign-compare]    androidAssimpExample        line 884    C/C++ Problem
narrowing conversion of 'ofGetWidth()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 64    C/C++ Problem
'void aiMatrix4x4ToOfMatrix4x4(const aiMatrix4x4&, ofNode&)' defined but not used [-Wunused-function]    androidAssimpExample        line 91    C/C++ Problem
narrowing conversion of 'ofGetHeight()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 52    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::pos' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
narrowing conversion of 'ofGetWidth()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 53    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::dir' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
narrowing conversion of 'ofGetHeight()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 65    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::pos' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
narrowing conversion of 'ofGetHeight()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 66    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::dir' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
narrowing conversion of 'ofGetHeight()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 64    C/C++ Problem
'void aiMeshToOfMesh(const aiMesh*, ofMesh&, ofxAssimpMeshHelper*)' defined but not used [-Wunused-function]    androidAssimpExample        line 42    C/C++ Problem
narrowing conversion of 'ofGetWidth()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 65    C/C++ Problem
The import javax.microedition.khronos.opengles.GL is never used    OFAndroidWindow.java    /ofAndroidLib/src/cc/openframeworks    line 6    Java Problem
narrowing conversion of 'ofGetWidth()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 52    C/C++ Problem
narrowing conversion of 'ofGetHeight()' from 'int' to 'GLfloat {aka float}' inside { } is ill-formed in C++11 [-Wnarrowing]    ofApp.cpp    /android3DModelLoaderExample/src    line 51    C/C++ Problem
comparison between signed and unsigned integer expressions [-Wsign-compare]    ofApp.cpp    /androidVibratorExample/src    line 26    C/C++ Problem
comparison between signed and unsigned integer expressions [-Wsign-compare]    ofApp.cpp    /androidVibratorExample/src    line 56    C/C++ Problem
ignoring packed attribute because of unpacked non-POD field 'aiVector3D aiRay::pos' [enabled by default]    androidAssimpExample        line 150    C/C++ Problem
'void aiMatrix4x4ToOfMatrix4x4(const aiMatrix4x4&, ofNode&)' defined but not used [-Wunused-function]    androidAssimpExample        line 91    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem
ignoring #pragma warning  [-Wunknown-pragmas]    android3DModelLoaderExample        line 10    C/C++ Problem

I’ve also tried to reinstall java 6, even if i have both installed… java 6 and 7, then i tried to use an old sdk vers 21.1 and nothing… gcc4.8 and 4.9 also are installed…