App crashing when calling takePicture()
See original GitHub issueFATAL EXCEPTION: main Process: , PID: 3794
java.lang.RuntimeException: Unable to start service tarun0.gyananter.CaptureService@7a5c685 with Intent { cmp=tarun0.gyananter/.CaptureService }: java.lang.RuntimeException: takePicture failed
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3335)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1578)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.lang.RuntimeException: takePicture failed
at android.hardware.Camera.native_takePicture(Native Method)
at android.hardware.Camera.takePicture(Camera.java:1461)
at android.hardware.Camera.takePicture(Camera.java:1406)
at com.androidhiddencamera.CameraPreview.takePictureInternal(CameraPreview.java:181)
at com.androidhiddencamera.HiddenCameraService.takePicture(HiddenCameraService.java:94)
at tarun0.gyananter.CaptureService.onStartCommand(CaptureService.java:63)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3318)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1578)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
camera.takePicture() is crashing my app - Stack Overflow
Use this simple code to capture using the device camera. IMP Note: Add those permision to the mainfest file
Read more >[Camera] cameraController.takePicture() crash app on call
Hello, I'm having issues with the Flutter camera plugin on Android, The app crashes whenever the _cameraController.takePicture() is called.
Read more >takePicture failed when I try to take photos and the ... - Reddit
You're calling getCameraInstance() when you create the object, and then again when it's time to take a picture. I don't think that's what...
Read more >CameraX crash on ImageCapture.takePhoto() [230454568]
CAMERA APPLICATION NAME AND VERSION: Hinge 8.32.0 ... DESCRIPTION: This is happening when takePicture() is called on the image capture.
Read more >In android emulator, whenever I call camera.TakePicture , the ...
However, I am unable to test my app because in the Android emulator, the camera app crashes whenever I have code that calls...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Maybe the issue is still open Exception java.lang.RuntimeException: takePicture failed
android.hardware.Camera.native_takePicture (Camera.java) android.hardware.Camera.takePicture (Camera.java:1473) android.hardware.Camera.takePicture (Camera.java:1418) com.androidhiddencamera.CameraPreview.takePictureInternal (CameraPreview.java:196) com.androidhiddencamera.HiddenCameraService.takePicture (HiddenCameraService.java:95) com.app.mytest.MyCamService$1.run (MyCamService.java:77) android.os.Handler.handleCallback (Handler.java:751) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:154) android.app.ActivityThread.main (ActivityThread.java:6776) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1518) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
On devices: Samsung SM-A320Y (API 24) Android 7.0 Samsung SM-A510F (API 24) Android 7.0 Samsung SM-G570F (API 24) Android 7.0 Samsung SM-G930A (API 24) Android 7.0 Samsung SM-G930F (API 24) Android 7.0 Samsung SM-G950F (API 24) Android 7.0 Samsung SM-J530FM (API 24) Android 7.0 Samsung SM-J710F (API 24) Android 7.0 Samsung SM-J701F (API 24) Android 7.0 Samsung SM-J700H (API 23) Android 6.0.1 Samsung SM-N920C (API 24) Android 7.0 Xiaomi Redmi Note 4 (API 24) Android 7.0 Motorola Moto G Play (API 23) Android 6.0.1
The application works on these devices, but sometimes this bug appears randomly. The most popular are samsung devices with android 7.0
I found this and this on Stackoverflow. Recommendations are as follows:
Add: SurfaceTexture st = new SurfaceTexture(MODE_PRIVATE); pCamera.setPreviewTexture(st); before: pCamera.startPreview();
works for me on honeywell ED70 , android 7