Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null image data on callback when running on Android 4.4 device #240

Closed
Diederikjh opened this issue Nov 14, 2017 · 8 comments
Closed

Null image data on callback when running on Android 4.4 device #240

Diederikjh opened this issue Nov 14, 2017 · 8 comments

Comments

@Diederikjh
Copy link

Diederikjh commented Nov 14, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes, mostly

Environment

Android studio 2.3.1 (running on Ubuntu) Build tools 27.0.1 Target SDK : 27
Camera kit version: 0.12.0
Seeing this on Android 4.4 devices. (Samsung SM-T561 and SM-T231)

Steps to Reproduce

  1. Launch linked project's app.
  2. Press capture button (it calls CameraView.captureImage())
  3. Note the toast says image callback's JPEG data is null.

Expected Behavior

Call back to provide non-null image data.

Actual Behavior

Callback returned null JPEG image data.

Reproducible Demo

https://github.com/Diederikjh/camerakit-crash/tree/android-4.4-null-image

This doesn't seem to happen on version 0.11.2 of the library.

Not sure if relevant. Log cat during failure had this output:

11-14 09:41:13.093 1658-1673/com.honeybeeapp.camerakittesting D/dalvikvm: Trying to load lib /data/app-lib/com.honeybeeapp.camerakittesting-4/libJniBitmapOperator.so 0x41e58018
11-14 09:41:13.093 1658-1673/com.honeybeeapp.camerakittesting D/dalvikvm: Added shared lib /data/app-lib/com.honeybeeapp.camerakittesting-4/libJniBitmapOperator.so 0x41e58018
11-14 09:41:13.093 1658-1673/com.honeybeeapp.camerakittesting D/dalvikvm: No JNI_OnLoad found in /data/app-lib/com.honeybeeapp.camerakittesting-4/libJniBitmapOperator.so 0x41e58018, skipping init
11-14 09:41:13.093 1658-1673/com.honeybeeapp.camerakittesting E/DEBUG: Bitmap format is not RGBA_8888!
@dwillmc
Copy link
Member

dwillmc commented Nov 14, 2017

Thanks for this issue. I'll have this fix out on an official release artifact within a week, but for now you can access the fix on a snapshot artifact.

Made a PR on your reproduction repo showing how to do this: Diederikjh/camerakit-crash#1

The problem was a pixel data config mismatch. I was assuming ARGB_8888 while older android versions will implicitly choose something else. Let me know if it's not fixed still and I'll investigate further.

@Diederikjh
Copy link
Author

Thanks, I'm getting correct data back on my 4.4 device.

@aravindhkumar23
Copy link

Hi @Diederikjh

did u accessed camera listener

// set listener for camera
        cameraView.setCameraListener(new CameraListener() {
            @Override
            public void onPictureTaken(byte[] picture) {
               // my code goes here
            }
        });

i am getting error in when using gradle

compile 'com.wonderkiln:camerakit:0.12.0'
compile group: 'com.wonderkiln', name:'camerakit', version:'0.12.1-Snapshot', changing: true

errors when listener is included,

cannot find symbol class CameraListener
cannot resolve method setCameraListener()

@dwillmc
Copy link
Member

dwillmc commented Nov 14, 2017

@aravindhkumar23

Remove compile 'com.wonderkiln:camerakit:0.12.0', only keep the line compile group: 'com.wonderkiln', name:'camerakit', version:'0.12.1-Snapshot', changing: true

You've upgraded from a version older than 0.12.0, where event handling has changed a bit. Change it to:


        cameraView.addCameraKitListener(new CameraKitEventListenerAdapter() {
            @Override
            public void onEvent(CameraKitEvent event) {
                super.onEvent(event);
            }

            @Override
            public void onError(CameraKitError error) {
                super.onError(error);
            }

            @Override
            public void onImage(CameraKitImage image) {
                super.onImage(image);
            }

            @Override
            public void onVideo(CameraKitVideo video) {
                super.onVideo(video);
            }
        });

@aravindhkumar23
Copy link

@dwillmc

Thanks, it seems the documentation is not updated.

@daniestrella1
Copy link

Same behavior with Android 4.4.2 and Camera kit version 0.12.0

Fatal Exception: java.lang.NullPointerException
       at com.wonderkiln.camerakit.CameraKitImage.getBitmap(CameraKitImage.java:20)

@avaneeshkumarmaurya
Copy link

This is fixed or not?
I am getting issue of null image in callback

@emersoncloud
Copy link
Contributor

Hi @avaneeshkumarmaurya we've actually moved most of our development efforts to version 1.0.0. This issue is resolved there. Check the PR #318 to get started with the latest beta. We'll have an official release shortly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants