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.

takePicture failed

See original GitHub issue
java.lang.RuntimeException: takePicture failed
at android.hardware.Camera.native_takePicture(Native Method)
at android.hardware.Camera.takePicture(Camera.java:1561)
at com.google.android.cameraview.Camera1.takePictureInternal(Camera1.java:230)
at com.google.android.cameraview.Camera1$2.onAutoFocus(Camera1.java:221)
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1199)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

Device: Honor SCL-AL00 OS: EMUI3.1.1(Android 5.1.1) other problem:call back onPictureTaken and save picture always.

Camera1.java

   @Override
    void takePicture() {
        if (!isCameraOpened()) {
            throw new IllegalStateException(
                    "Camera is not ready. Call start() before takePicture().");
        }
        if (getAutoFocus()) {
            mCamera.cancelAutoFocus();
            mCamera.autoFocus(new Camera.AutoFocusCallback() {
                @Override
                public void onAutoFocus(boolean success, Camera camera) {
                    takePictureInternal();
                }
            });
        } else {
            takePictureInternal();
        }
    }

takePictureInternal(); mCamera.cancelAutoFocus(); it is work.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
dannyroacommented, Feb 21, 2017

@yaraki: I have this issue as well.

0reactions
aswalalkacommented, Jul 5, 2017

Is it fixed, I am facing the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.RuntimeException: takePicture failed - Stack Overflow
Declare a flag as a member of your Activity: · In surfaceChanged() , just set the flag to true after calling startPreview(): ·...
Read more >
java.lang.RuntimeException: takePicture failed with ... - B4X
Hi all: My workmates use my app to make a lot of pics of their jobs. I use to make the pictures CameraExClass...
Read more >
Exception java.lang.RuntimeException: takePicture failed #361
Exception java.lang.RuntimeException: takePicture failed #361. Open.
Read more >
Android : java.lang.RuntimeException: takePicture failed
Android : java.lang.RuntimeException: takePicture failed [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] Android ...
Read more >
takePicture failed when I try to take photos and the application ...
RuntimeException: takePicture failed at android.app.ActivityThread. ... takePicture(Camera.java:1551) at android.hardware.Camera.
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