Error with onPreviewFrame Callback when trying to get current camera frame as bitmap

By : Luis

I try to get the single camera frames as bitmaps like in this answer:

public void onPreviewFrame(byte[] data, Camera camera) {

    yuvType = new Type.Builder(rs, Element.U8(rs)).setX(data.length);
    in = Allocation.createTyped(rs, yuvType.create(), Allocation.USAGE_SCRIPT);

    rgbaType = new Type.Builder(rs, Element.RGBA_8888(rs));
    rgbaType.setY(height); //From Camera.Size
    out = Allocation.createTyped(rs, rgbaType.create(), Allocation.USAGE_SCRIPT);



    Bitmap bmpout = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);


When I run this, it works perfectly until


I get a error in the logcat and the application closes after a few seconds but doesn't show any kind of error.

Logcat error:

A/libc: Fatal signal 11 (SIGSEGV), code 128, fault addr 0x0 in tid 5121 (//package name of my app)
A/libc: Fatal signal 11 (SIGSEGV) in tid 5122 (//package name of my app)

I tried it on an other device and it worked. Can somebody tell me what I have to do that it works on every devices?

By : Luis

This video can help you solving your question :)
By: admin