以下代码在调用start时抛出错误:
_recorder = new MediaRecorder();
_recorder.SetAudioSource(AudioSource.Mic);
_recorder.SetVideoSource(VideoSource.Camera);
_recorder.SetProfile(CamcorderProfile.Get(CamcorderQuality.High));
_recorder.SetOutputFile(FileName);
_recorder.SetMaxDuration(10000);
_recorder.Prepare();
_recorder.Start();
错误消息似乎总是如下:
Java.Lang.RuntimeException: start failed.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod(Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <25999cc1fde6426b852c2e027711c254>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod(System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <25999cc1fde6426b852c2e027711c254>:0
at Android.Media.MediaRecorder.Start () [0x0000a] in <7a2bbe1fcaec4467930361ae212aeea9>:0
at MobileTwo.Droid.Services.AndroidCamera.InitializeCamera () [0x00120] in C:\GitRepositories\mobile-two\MobileTwo\MobileTwo.Droid\Services\AndroidCamera.cs:198
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.InnerGestureListener.n_onSingleTapUp(Native Method)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.InnerGestureListener.onSingleTapUp(InnerGestureListener.java:79)
at android.view.GestureDetector.onTouchEvent(GestureDetector.java:635)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onTouch(Native Method)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onTouch(VisualElementRenderer_1.java:66)
at android.view.View.dispatchTouchEvent(View.java:9296)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2547)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2240)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
在
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
在android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_dispatchTouchEvent(母语 方法)at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.dispatchTouchEvent(PlatformRenderer.java:55) 在 android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553) 在android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)at com.android.internal.policy.PhoneWindow $ DecorView.superDispatchTouchEvent(PhoneWindow.java:2403) 在 com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1737) 在android.app.Activity.dispatchTouchEvent(Activity.java:2771)处 android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) 在 android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) 在 com.android.internal.policy.PhoneWindow $ DecorView.dispatchTouchEvent(PhoneWindow.java:2364) 在android.view.View.dispatchPointerEvent(View.java:9520)at android.view.ViewRootImpl $ ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4230) 在 android.view.ViewRootImpl $ ViewPostImeInputStage.onProcess(ViewRootImpl.java:4096) 在 android.view.ViewRootImpl $ InputStage.deliver(ViewRootImpl.java:3642) 在 android.view.ViewRootImpl $ InputStage.onDeliverToNext(ViewRootImpl.java:3695) 在 android.view.ViewRootImpl $ InputStage.forward(ViewRootImpl.java:3661) 在 android.view.ViewRootImpl $ AsyncInputStage.forward(ViewRootImpl.java:3787) 在android.view.ViewRootImpl $ InputStage.apply(ViewRootImpl.java:3669) 在 android.view.ViewRootImpl $ AsyncInputStage.apply(ViewRootImpl.java:3844) 在 android.view.ViewRootImpl $ InputStage.deliver(ViewRootImpl.java:3642) 在 android.view.ViewRootImpl $ InputStage.onDeliverToNext(ViewRootImpl.java:3695) 在 android.view.ViewRootImpl $ InputStage.forward(ViewRootImpl.java:3661) 在android.view.ViewRootImpl $ InputStage.apply(ViewRootImpl.java:3669) 在 android.view.ViewRootImpl $ InputStage.deliver(ViewRootImpl.java:3642) 在 android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5922) 在 android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5896) 在 android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5857) 在 android.view.ViewRootImpl $ WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6025) 在 android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) 在android.os.MessageQueue.nativePollOnce(Native Method)at android.os.MessageQueue.next(MessageQueue.java:323)at android.os.Looper.loop(Looper.java:135)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) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)}
我检查过,并且我拥有正确的清单权限。知道还有什么可能是错误的配置? (我正在使用Nexus 7平板电脑进行调试)
编辑:这是我的清单
<uses-feature android:name="android.hardware.camera.front" />
<uses-feature android:name="android.hardware.microphone" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />