question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setParameters failed

See original GitHub issue

Unable to set parameters in certain devices(Redmi Note 3)

List<Camera.Size> pictureSizes = mCamera.getParameters().getSupportedPictureSizes();

        //set the preview sizes that are the lowest, as we don't have to display the preview.
        parameters.setPreviewSize(pictureSizes.get(pictureSizes.size() - 1).width,
                pictureSizes.get(pictureSizes.size() - 1).height);

        //set the camera image size based on config provided
        Camera.Size cameraSize;
        switch (mCameraConfig.getResolution()) {
            case CameraResolution.HIGH_RESOLUTION:
                cameraSize = pictureSizes.get(0);   //Highest res
                break;
            case CameraResolution.MEDIUM_RESOLUTION:
                cameraSize = pictureSizes.get(pictureSizes.size() / 2);     //Resolution at the middle
                break;
            case CameraResolution.LOW_RESOLUTION:
                cameraSize = pictureSizes.get(pictureSizes.size() - 1);       //Lowest res
                break;
            default:
                throw new RuntimeException("Invalid camera resolution.");
        }
        parameters.setPictureSize(cameraSize.width, cameraSize.height);

removing this code under CamPreview.java fixes the issue. Can you please remove it and push

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hussainbadri21commented, Dec 16, 2016

Thanks a lot,everything is working fine now.

On Friday, December 16, 2016 1:04 PM, Keval Patel <notifications@github.com> wrote:

@hussainbadri21 v1.2 is live with above fix. Check that out.— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

0reactions
coolutkarshrajcommented, Aug 24, 2017

And for providing this library thankyou

Read more comments on GitHub >

github_iconTop Results From Across the Web

Camera java.lang.RuntimeException: setParameters failed
RuntimeException setParameters failed. I am facing this exception, due to this: params.setPictureSize(1200, 900);.
Read more >
java.lang.RuntimeException: setParameters failed #940 - GitHub
Fatal Exception: java.lang.RuntimeException: setParameters failed at android.hardware.Camera.native_setParameters(Camera.java) at ...
Read more >
camera.setParameters failed in android - iTecNote
I have tested the app on the device on 2.1. The error I got from the user is using nexus one which will...
Read more >
Redmi Note 5 AI Camera Keep Stopping - XDA Forums
RuntimeException: setParameters failed at android.hardware.Camera.native_setParameters(Native Method) at android.hardware.Camera.
Read more >
java.lang.RuntimeException: setParameters failed at android ...
java.lang.RuntimeException : setParameters failed at android.hardware.Camera.native_setParameters(Na. 50 views50 views. Sep 25, 2020.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found