gpt4 book ai didi

android - 使用 Library CWAC CAM2 拍摄时因方向改变而崩溃

转载 作者:行者123 更新时间:2023-11-29 20:05:35 24 4
gpt4 key购买 nike

我在使用 CommonsWare 库 cwac:cam2 的 nexus 5 Android 6(锤击/锤击)上崩溃了

当我改变录制/拍照 Activity 的方向时。该错误在我的设备上是系统性的。

堆栈跟踪:

E / AndroidRuntime: FATAL EXCEPTION: main
Process: com.m360learning.android, PID: 9637
java.lang.RuntimeException: Unable to start activity ComponentInfo {
com.m360learning.android / com.commonsware.cwac.cam2.VideoRecorderActivity
}: de.greenrobot.event.EventBusException: Subscriber class com.commonsware.cwac.cam2.CameraFragment already registered to event class com.commonsware.cwac.cam2.CameraController$ControllerReadyEvent
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2476)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java: 4077)
at android.app.ActivityThread. - wrap15(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 1350)
at android.os.Handler.dispatchMessage(Handler.java: 102)
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)
Caused by: de.greenrobot.event.EventBusException: Subscriber class com.commonsware.cwac.cam2.CameraFragment already registered to event class com.commonsware.cwac.cam2.CameraController$ControllerReadyEvent
at de.greenrobot.event.EventBus.subscribe(EventBus.java: 179)
at de.greenrobot.event.EventBus.register(EventBus.java: 165)
at de.greenrobot.event.EventBus.register(EventBus.java: 133)
at com.commonsware.cwac.cam2.CameraFragment.onStart(CameraFragment.java: 123)
at android.app.Fragment.performStart(Fragment.java: 2244)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java: 1002)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java: 1148)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java: 1130)
at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java: 1958)
at android.app.FragmentController.dispatchStart(FragmentController.java: 163)
at android.app.Activity.performStart(Activity.java: 6274)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2379)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2476)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java: 4077)
at android.app.ActivityThread. - wrap15(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 1350)
at android.os.Handler.dispatchMessage(Handler.java: 102)
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)

非常感谢您的支持,修复非常迅速。

最佳答案

问题是您正在尝试注册服务两次,如您在跟踪中所见,请在此处输入代码。该服务不是未注册的,因此最简单的选择是在注册之前检查该服务是否已注册挂号的。例如:

if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}

关于android - 使用 Library CWAC CAM2 拍摄时因方向改变而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35706639/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com