2

I know that my question was asked before.

But no solution is working for me.

For now I tried this solutions:

  1. Solution 1

  2. Solution 2

  3. Solution 3

  4. Solution 4

But no one of them worked for me.

My application project include a JNI part so I added all the mentioned line from THIS tutorial to the Android.mk file,

I comment this line :

if(!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback));

And added:

    static {
    if (!OpenCVLoader.initDebug()) {
        // Handle initialization error
    }
}

After public void onResume()

My application gets stuck and crushed when the OpenCV started.

This is the LogCat output:

04-16 10:00:25.020: W/System.err(14797): java.io.FileNotFoundException: /storage/emulated/0/DCIM/Frames/20140416_100025.mp4: open failed: ENOENT (No such file or directory)
04-16 10:00:25.020: W/System.err(14797):    at libcore.io.IoBridge.open(IoBridge.java:409)
04-16 10:00:25.020: W/System.err(14797):    at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
04-16 10:00:25.020: W/System.err(14797):    at java.io.FileOutputStream.<init>(FileOutputStream.java:128)
04-16 10:00:25.020: W/System.err(14797):    at java.io.FileOutputStream.<init>(FileOutputStream.java:117)
04-16 10:00:25.025: W/System.err(14797):    at android.media.MediaRecorder.prepare(MediaRecorder.java:776)
04-16 10:00:25.025: W/System.err(14797):    at com.example.homedevice.SampleTestingAct.prepareRecorder(SampleTestingAct.java:371)
04-16 10:00:25.025: W/System.err(14797):    at com.example.homedevice.SampleTestingAct.StartTest(SampleTestingAct.java:443)
04-16 10:00:25.025: W/System.err(14797):    at com.example.homedevice.SampleTestingAct.access$0(SampleTestingAct.java:420)
04-16 10:00:25.025: W/System.err(14797):    at com.example.homedevice.SampleTestingAct$2$1.run(SampleTestingAct.java:2037)
04-16 10:00:25.025: W/System.err(14797):    at java.util.Timer$TimerImpl.run(Timer.java:284)
04-16 10:00:25.025: W/System.err(14797): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
04-16 10:00:25.025: W/System.err(14797):    at libcore.io.Posix.open(Native Method)
04-16 10:00:25.030: W/System.err(14797):    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
04-16 10:00:25.030: W/System.err(14797):    at libcore.io.IoBridge.open(IoBridge.java:393)
04-16 10:00:25.030: W/System.err(14797):    ... 9 more
04-16 10:00:25.260: E/MediaRecorder(14797): start called in an invalid state: 4
04-16 10:00:25.260: W/dalvikvm(14797): threadid=16: thread exiting with uncaught exception (group=0x41c44700)
04-16 10:00:25.260: E/AndroidRuntime(14797): FATAL EXCEPTION: Timer-2
04-16 10:00:25.260: E/AndroidRuntime(14797): java.lang.IllegalStateException
04-16 10:00:25.260: E/AndroidRuntime(14797):    at android.media.MediaRecorder.start(Native Method)
04-16 10:00:25.260: E/AndroidRuntime(14797):    at com.example.homedevice.SampleTestingAct.StartTest(SampleTestingAct.java:445)
04-16 10:00:25.260: E/AndroidRuntime(14797):    at com.example.homedevice.SampleTestingAct.access$0(SampleTestingAct.java:420)
04-16 10:00:25.260: E/AndroidRuntime(14797):    at com.example.homedevice.SampleTestingAct$2$1.run(SampleTestingAct.java:2037)
04-16 10:00:25.260: E/AndroidRuntime(14797):    at java.util.Timer$TimerImpl.run(Timer.java:284)
04-16 10:00:32.555: I/Choreographer(14797): Skipped 436 frames!  The application may be doing too much work on its main thread.
04-16 10:00:32.715: E/ViewSystem(14797): ViewRootImpl #2 Surface is not valid.
04-16 10:00:32.725: E/MediaRecorder(14797): stop called in an invalid state: 4
04-16 10:00:32.725: D/AndroidRuntime(14797): Shutting down VM
04-16 10:00:32.725: W/dalvikvm(14797): threadid=1: thread exiting with uncaught exception (group=0x41c44700)
04-16 10:00:32.730: I/Process(14797): Sending signal. PID: 14797 SIG: 9
04-16 10:00:33.060: D/dalvikvm(15019): GC_FOR_ALLOC freed 56K, 12% free 9605K/10840K, paused 13ms, total 14ms
04-16 10:00:33.060: I/dalvikvm-heap(15019): Grow heap (frag case) to 11.604MB for 1127536-byte allocation
04-16 10:00:33.080: D/dalvikvm(15019): GC_FOR_ALLOC freed <1K, 11% free 10706K/11944K, paused 20ms, total 20ms
04-16 10:00:33.115: D/dalvikvm(15019): GC_FOR_ALLOC freed <1K, 10% free 11593K/12832K, paused 11ms, total 11ms
04-16 10:00:33.200: D/libEGL(15019): loaded /system/lib/egl/libEGL_mali.so
04-16 10:00:33.200: D/libEGL(15019): loaded /system/lib/egl/libGLESv1_CM_mali.so
04-16 10:00:33.205: D/libEGL(15019): loaded /system/lib/egl/libGLESv2_mali.so
04-16 10:00:33.210: E/(15019): Device driver API match
04-16 10:00:33.210: E/(15019): Device driver API version: 23
04-16 10:00:33.210: E/(15019): User space API version: 23 
04-16 10:00:33.210: E/(15019): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct  9 21:05:57 KST 2013 
04-16 10:00:33.265: D/OpenGLRenderer(15019): Enabling debug mode 0

Is it possible to work with OpenCV without the OpenCV manager(maybe include him in my app?) Hope that someone can help here.

Thanks!

Community
  • 1
  • 1
user2235615
  • 1,513
  • 3
  • 17
  • 37

1 Answers1

0

sure you can do that. You just need to have the specific OpenCV libraries packed in your APK. Have a look at my reply here.

TeddybearCrisis
  • 269
  • 1
  • 9