android camera2示例应用程序android-Camera2Basic在第一次捕获后抛出异常

时间:2015-07-06 07:31:46

标签: android android-camera

我使用的是google示例应用程序camera2basic(https://github.com/googlesamples/android-Camera2Basic),但在执行第一次图片捕获后会抛出异常。我看到相机已关闭,但如何正确修理?我希望谷歌样本能够显示正确的生命周期。 这是一个例外:

07-06 10:26:00.296    8066-8110/com.example.android.camera2basic I/RequestQueue﹕ Repeating capture request set.
07-06 10:26:00.571    8066-8111/com.example.android.camera2basic V/RenderScript﹕ 0x9e643200 Launching thread(s), CPUs 8
07-06 10:26:19.656    8066-8078/com.example.android.camera2basic W/CameraBase﹕ mediaserver's remote binder Camera object died
07-06 10:26:19.661    8066-8083/com.example.android.camera2basic W/CameraBase﹕ Camera service died!
07-06 10:26:19.661    8066-8144/com.example.android.camera2basic E/Camera﹕ Error 100
07-06 10:26:19.661    8066-8144/com.example.android.camera2basic E/RequestThread-0﹕ Received error 100 from the Camera1 ErrorCallback
07-06 10:26:19.661    8066-8144/com.example.android.camera2basic I/CameraDeviceState﹕ Legacy camera service transitioning to state ERROR
07-06 10:26:22.671    8066-8166/com.example.android.camera2basic E/RequestThread-0﹕ Hit timeout for jpeg callback!
07-06 10:26:22.671    8066-8166/com.example.android.camera2basic W/RequestHolder﹕ Capture failed for request: 3
07-06 10:26:22.671    8066-8166/com.example.android.camera2basic I/CameraDeviceState﹕ Legacy camera service transitioning to state CAPTURING
07-06 10:26:22.671    8066-8166/com.example.android.camera2basic E/CameraDeviceState﹕ Cannot call capture while in state: 0
07-06 10:26:22.681    8066-8166/com.example.android.camera2basic E/RequestThread-0﹕ Received device exception:
    java.lang.RuntimeException: getParameters failed (empty parameters)
            at android.hardware.Camera.native_getParameters(Native Method)
            at android.hardware.Camera.getParameters(Camera.java:1953)
            at android.hardware.camera2.legacy.RequestThreadManager$5.handleMessage(RequestThreadManager.java:807)
            at android.os.Handler.dispatchMessage(Handler.java:98)
            at android.os.Looper.loop(Looper.java:145)
            at android.os.HandlerThread.run(HandlerThread.java:61)
07-06 10:26:22.781    8066-8066/com.example.android.camera2basic W/CameraCaptureSession﹕ Session 0: The camera device was already closed:
    java.lang.IllegalStateException: CameraDevice was already closed
            at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:1482)
            at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:677)
            at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:328)
            at com.example.android.camera2basic.Camera2BasicFragment.closeCamera(Camera2BasicFragment.java:560)
            at com.example.android.camera2basic.Camera2BasicFragment.onPause(Camera2BasicFragment.java:468)
            at android.app.Fragment.performPause(Fragment.java:2318)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:954)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1064)
            at android.app.FragmentManagerImpl.dispatchPause(FragmentManager.java:1898)
            at android.app.Activity.performPause(Activity.java:6366)
            at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1308)
            at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3647)
            at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3620)
            at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3595)
            at android.app.ActivityThread.access$1100(ActivityThread.java:172)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:145)
            at android.app.ActivityThread.main(ActivityThread.java:5834)
            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:1388)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)

0 个答案:

没有答案