-
Notifications
You must be signed in to change notification settings - Fork 407
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
Fatal Exception: io.fotoapparat.hardware.CameraException java.lang.RuntimeException: Fail to connect to camera service #50
Comments
Hi, thanks for the report! Few generic questions which should help us to analyze the problem:
|
In the meanwhile, please try updating to 1.0.3. It will not fix the problem itself, but it will include more information into exception's message. |
1. Is issue reproducible? If yes, how easy is it to reproduce?Completely reproducible. Happens every time you try to use the camera on said phone. 2. If app just crashes in 100% of the cases for this device, do other camera apps work? Sometimes it can be that camera hardware stops working in all apps. Restarting the device should help.Yes. It was working previously with another camera library (https://github.com/gogopop/CameraKit-Android) which we decided to swap out to fix intermittent crashes. 3. Do you have more related crashes on the same type of the device? Or is it just this one user?Yes. It has also crashed on a Samsung SM-G900F as well as Huawei Ascend Y330. A new stack trace for version 1.0.2 Fatal Exception: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: startPreview failed |
It's rather easy to reproduce this on any device. Just turn on the flashlight, then go to your app that uses Fotoapparat. I doubt that was what happened in those other instances, but documentation of
I don't see how I can prevent my app from crashing in that scenario, as a consumer of the Fotoapparat API. |
@arekolek thanks for the suggestion. I can't really reproduce it on Samsung S7 Edge, but I will try to find other devices. Either way, if what you describe is true - we can't really provide an access to camera, but we can at least allow you to handle the error yourself. |
I am closing it in favor of #55 From what I can tell now - a camera just can't be opened because the system does not allow us to do so. We pass exactly 1 parameter, so there is not much we can do wrong. When there will be more information available, we'll reopen it. |
Hi
One of our users is getting these crashes whilst trying to use the camera.
Phone model: HTC One mini 2
Android version: 4.4.2
Stack trace 1:
Fatal Exception: io.fotoapparat.hardware.CameraException: java.lang.RuntimeException: Fail to connect to camera service
at io.fotoapparat.hardware.v1.Camera1.open(Camera1.java:63)
at io.fotoapparat.routine.StartCameraRoutine.run(StartCameraRoutine.java:39)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:864)
Caused by java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.native_setup(Camera.java)
at android.hardware.Camera.(Camera.java:549)
at android.hardware.Camera.open(Camera.java:424)
at io.fotoapparat.hardware.v1.Camera1.open(Camera1.java:60)
at io.fotoapparat.routine.StartCameraRoutine.run(StartCameraRoutine.java:39)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:864)
Stack trace 2:
Fatal Exception: java.lang.NullPointerException
at io.fotoapparat.hardware.v1.Camera1.stopPreview(Camera1.java:123)
at io.fotoapparat.routine.StopCameraRoutine.run(StopCameraRoutine.java:18)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:864)
The text was updated successfully, but these errors were encountered: