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

Unhandled RuntimeException exception causing app crash #40

Open
jstakun opened this issue Sep 13, 2018 · 0 comments
Open

Unhandled RuntimeException exception causing app crash #40

jstakun opened this issue Sep 13, 2018 · 0 comments

Comments

@jstakun
Copy link

jstakun commented Sep 13, 2018

On one device I receive following exception which is unhandled and causes app crash:

Value: java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native Method)
at com.androidhiddencamera.CameraPreview.surfaceChanged(CameraPreview.java:139)
at android.view.SurfaceView.updateWindow(SurfaceView.java:580)
at android.view.SurfaceView.access$000(SurfaceView.java:86)
at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:174)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:680)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1842)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:532)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)

Solution to catch this exception and prevent app crash is to set catch (IOException | RuntimeException e)
in https://github.com/kevalpatel2106/android-hidden-camera/blob/master/hiddencamera/src/main/java/com/androidhiddencamera/CameraPreview.java#L142

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

1 participant