Camera view crash on standalone build android

#1

Hi, I need help with camera on standalone build android.
I make standalone apk using the normal exp build:android command and so far I got 2 kinds of error on camera:

  1. On a simple app with only a camera inside the view I got a crash: with unknown error in the usual expo blue screen.

    This is the snack link: https://snack.expo.io/S1ZgfaYJf
    and this is the apk if you want to try https://exp-shell-app-assets.s3-us-west-1.amazonaws.com/android%2F%40adhicl%2Fcamera-video-capture-e44d6619-ca06-11e7-9929-0a580a781909-signed.apk.
  2. On another app that I make, I could create and run the app, but when I try to record, the app will get crash with this logcat:

java.lang.IllegalStateException
at android.media.MediaRecorder.stop(Native Method)
at com.google.android.cameraview.b.b(Camera2.java:266)
at com.google.android.cameraview.b$5.b(Camera2.java:232)
at com.google.android.cameraview.g.f(PreviewImpl.java:60)
at com.google.android.cameraview.l$1.onSurfaceTextureDestroyed(TextureViewPreview.java:58)
at android.view.TextureView.destroySurface(TextureView.java:237)
at android.view.TextureView.destroyHardwareResources(TextureView.java:340)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:172)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyResources(ThreadedRenderer.java:179)
at android.view.ThreadedRenderer.destroyHardwareResources(ThreadedRenderer.java:167)
at android.view.ViewRootImpl.destroyHardwareResources(ViewRootImpl.java:671)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1385)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Please remember for both occasion, it will only happen when I run it from the buildalone apk file but not from the expo app.
Am I missing something?

#2

Hi @adhicl , the first one is caused because you Camera permissions are not set, sorry for not having any description for that case, I’ll fix it soon so a proper rejection message is sent. I’m still trying to work out the second case. Thanks for reporting!

2 Likes
#3

Hi @aalices, how is it going with the second case? Can you reproduce it? Any progress?

#4

Hey, I think I found the reason but not yet a fix for this. This all happens because the component rerenders when the top icon is changed and I have to find some way so it won’t crash.

#5

Ok @aalices, great at least I know that it is an error. Thanks, hope it can be fixed soon :slight_smile:

#6

Anyway, does this always happen in your case? Or maybe only when the audio recording permission dialog appears?

#7

For me it always happen. And only when I make it into standalone build. I also already add all the permission needed to my app.json

#8

@adhicl for the second case, can you provide code that reflects behavior of app that is crashing?

#9

Hi @aalices, after I update to expo 24 it seems like it does not crash anymore?

1 Like