Android媒体录制器在停止时崩溃

时间:2017-04-21 17:59:22

标签: android google-api android-mediarecorder android-camera2

我尝试使用此链接实现google提供的camera2api https://github.com/googlesamples/android-Camera2Video

一切正常但在停止视频后应用程序崩溃了mediarecorder.stop()

我使用的是小米4A

logcat的:

4-21 23:37:42.189 20375-20375 /? E / AndroidRuntime:致命异常:主要                                                    处理:com.example.android.camera2video,PID:20375                                                    java.lang.RuntimeException:停止失败。                                                        在android.media.MediaRecorder.stop(Native方法)                                                        at com.example.android.camera2video.Camera2VideoFragment.stopRecordingVideo(Camera2VideoFragment.java:687)                                                        在com.example.android.camera2video.Camera2VideoFragment.onClick(Camera2VideoFragment.java:314)                                                        在android.view.View.performClick(View.java:5207)                                                        在android.view.View $ PerformClick.run(View.java:21177)                                                        在android.os.Handler.handleCallback(Handler.java:739)                                                        在android.os.Handler.dispatchMessage(Handler.java:95)                                                        在android.os.Looper.loop(Looper.java:148)                                                        在android.app.ActivityThread.main(ActivityThread.java:5441)                                                        at java.lang.reflect.Method.invoke(Native Method)                                                        在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:738)                                                        在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)

1 个答案:

答案 0 :(得分:0)

我使用了相同的链接,它在我的小米4A 上的mediarecorder.onStop()崩溃了,它正在提供IllegalStateException,但代码与其他设备完全正常。

我通过简单地使用miui updater更新我的设备解决了这个问题。