【问题标题】:Cwac-camera crash when picture taken拍照时 Cwac 相机崩溃
【发布时间】:2013-07-03 19:09:58
【问题描述】:

当我通过 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)

【问题讨论】:

  • 您的跟踪有一个caused by 部分。

标签: android camera commonsware-cwac


【解决方案1】:

这个崩溃不是来自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有关,然后进一步希望我能弄清楚是什么问题。

【讨论】:

  • 我正在使用 v.0.0.2 并将 android:screenOrientation="portrait" 锁定到我的 AndroidManifest.xml。你有没有试过这个。问候,
  • @QuentinRousseau:如果一切顺利的话,我会在这个周末的某个时候看看它。
  • 精度:在 android:screenOrientation="portrait" 未设置时运行良好,但在方向更改时崩溃。问候,
  • @QuentinRousseau:好的,我可以重现该问题,并且至少可以将其最小化,可能完全修复。监视 github.com/commonsguy/cwac-camera/issues/12 以了解我何时发布包含修复的更新。
  • 非常感谢。我现在将对其进行测试。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-15
  • 1970-01-01
  • 2013-10-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多