照片拍摄时Cwac相机崩溃

时间:2013-07-03 19:09:59

标签: android camera commonsware-cwac

当我的照片通过 takePicture()功能拍摄时,Cwac相机崩溃(取决于设备,在Desire HD上运行良好,在Nexus S上崩溃)。

参考这篇文章:camera.setParameters failed in android

我想知道如何用Cwac-camera做到这一点。

回溯:

07-03 20:58:57.207  24659-24659/com.xxxxxx                    E/AndroidRuntime: FATAL EXCEPTION: main
    java.lang.RuntimeException: setParameters failed
    at android.hardware.Camera.native_setParameters(Native Method)
    at android.hardware.Camera.setParameters(Camera.java:1410)
    at com.commonsware.cwac.camera.CameraView$OnOrientationChange.onOrientationChanged(CameraView.java:413)
    at android.view.OrientationEventListener$SensorEventListenerImpl.onSensorChanged(OrientationEventListener.java:143)
    at android.hardware.SystemSensorManager$ListenerDelegate$1.handleMessage(SystemSensorManager.java:204)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4745)
    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:786)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

此次崩溃不是来自takePicture()。如果查看堆栈跟踪,您将看不到takePicture()。相反,这是来自方向的变化。具体来说,您似乎将设备锁定到某个方向,导致CameraView使用传感器检测设备方向以尝试调整相机设置,我们就在那里死亡。

如果您可以使用演示应用程序重现此问题,请file an issue执行重现步骤,因为我无法使用演示应用程序在Nexus S上重现它。

如果您无法使用演示应用重现此问题,并且您可以发布可重现的测试用例,请file an issue with the source code to the reproducible test case

否则,您将不得不希望您遇到的问题与this issue on switching cameras with the Nexus S有关,然后希望我能找出问题所在。