Ask Your Question

Asaf's profile - activity

2013-12-24 01:49:55 -0600 commented question Getting NoClassDefFoundError for nMatToBitmap2 on some devices

I listed the devices on which the error occurred in my initial post, to which have been recently added Sony Xperia GO and Android S930 (running android version 4.03). On all other devices (almost 400 types) it didn't happen.

2013-12-23 09:28:59 -0600 commented question Getting NoClassDefFoundError for nMatToBitmap2 on some devices

I call it in a function that is called from onCameraFrame (a function of CvCameraViewListener)

2013-12-22 01:42:10 -0600 received badge  Editor (source)
2013-12-22 01:40:28 -0600 commented question Getting NoClassDefFoundError for nMatToBitmap2 on some devices

ok, I added

2013-12-19 06:13:33 -0600 asked a question Getting NoClassDefFoundError for nMatToBitmap2 on some devices

I have an Android application on Google Play that uses OpenCV. I use OpenCV's matToBitmap to save images from the camera. OpenCV's native files are included in the project. I use Flurry to be informed of crashes. Many crashes were with this trace:

java.lang.NoClassDefFoundError
org.opencv.android.Utils.nMatToBitmap2(Native Method)
org.opencv.android.Utils.matToBitmap(Unknown Source)
                         matToBitmap
org.opencv.android.Utils.matToBitmap(Unknown Source)
                         matToBitmap
org.opencv.android.CameraBridgeViewBase.processEnterState(Unknown Source)
                                        deliverAndDrawFrame
                                        disconnectCamera
                                        calculateCameraFrameSize
org.opencv.android.JavaCameraView$CameraWorker.run(Unknown Source)
java.lang.Thread.run(Thread.java:1019)
Caused by: dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
org.opencv.android.Utils.nMatToBitmap2(Native Method)
org.opencv.android.Utils.matToBitmap(Unknown Source)
                         matToBitmap
org.opencv.android.Utils.matToBitmap(Unknown Source)
                         matToBitmap
org.opencv.android.CameraBridgeViewBase.processEnterState(Unknown Source)
                                        deliverAndDrawFrame
                                        disconnectCamera
                                        calculateCameraFrameSize
org.opencv.android.JavaCameraView$CameraWorker.run(Unknown Source)
java.lang.Thread.run(Thread.java:1019)

It happened in these devices, all of which with API 10:

Samsung Galaxy Ace (GT-S5830)
ZTE Groove X501
Samsung Galaxy Ace 2 
LG Optimus L3 (E400) 
LG Optimus NET DUAL (P698F)
Samsung Galaxy Mini (GT-S5570L) 
LG Optimus Q/Aloha

I would be happy to know what could cause this problem, and if it's possible to fix it.

Thanks.

code sample:

public void takePicture(Mat picture){
    Bitmap bitmap;
    bitmap = Bitmap.createBitmap(picture.width(), picture.height(), Bitmap.Config.ARGB_8888);
    Utils.matToBitmap(picture, bitmap);
    try
    {
        createThumbnailAndSave(bitmap, createPicTimeStr());
        bitmap.recycle();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}