CastClassException(布尔值到 ZoomStyle)

CastClassException ( boolean to ZoomStyle )

我在尝试启动 VideoRecorderActivity 时出现 CastClassException。这是我这样做的方式:

mTempVideoFile = new File(getContext().getFilesDir(), DateTime.now().getMillis()+"videoAndroid.mp4");

Intent takeVideoIntent=new VideoRecorderActivity.IntentBuilder(getContext())
            .quality(VideoRecorderActivity.Quality.LOW)
            .durationLimit(60000)
            .to(mTempVideoFile)
            .debug()
            .build();

startActivityForResult(takeVideoIntent, ACTION_TAKE_VIDEO);

堆栈跟踪:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m360learning.android/com.commonsware.cwac.cam2.VideoRecorderActivity}: java.lang.ClassCastException: java.lang.Boolean cannot be cast to com.commonsware.cwac.cam2.ZoomStyle
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                       at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                       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: java.lang.ClassCastException: java.lang.Boolean cannot be cast to com.commonsware.cwac.cam2.ZoomStyle
                                                       at com.commonsware.cwac.cam2.CameraFragment.getZoomStyle(CameraFragment.java:452)
                                                       at com.commonsware.cwac.cam2.CameraFragment.onCreateView(CameraFragment.java:203)
                                                       at android.app.Fragment.performCreateView(Fragment.java:2220)
                                                       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:973)
                                                       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
                                                       at android.app.BackStackRecord.run(BackStackRecord.java:793)
                                                       at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1535)
                                                       at android.app.FragmentController.execPendingActions(FragmentController.java:325)
                                                       at android.app.Activity.performStart(Activity.java:6267)
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                       at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                       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) 

此外,我 skipConfirm() 在文档中,但在我的代码中未被识别,这让我觉得我的库版本可能有误。

我从这个 maven repo "https://s3.amazonaws.com/repo.commonsware.com" 中获取了这个版本 'com.commonsware.cwac:cam2:0.5.+'

谢谢!

I had a CastClassException when trying to launch a VideoRecorderActivity

是的,那是 a bug。我会尽快解决这个问题。

Also I skipConfirm() is in the documentation but is not recognized in my code which make me think maybe I have the wrong version of the library.

不,这是文档错误,因为静态图片上只有确认屏幕,视频上没有。