我在使用 Android Studio 在我的真机上测试样例路径为 E:\Android_SDK\samples\android-22\media\MediaRecorder 的代码时,遇到了以下错误,请问是什么原因造成的?这个样例中是否存在一些 bug?
顺便提一下,我的安卓版本是 5.1。
09-28 16:09:31.683 17233-17233/com.example.android.mediarecorder E/Zygote﹕ v2
09-28 16:09:31.683 17233-17233/com.example.android.mediarecorder E/SELinux﹕ [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
09-28 16:10:06.343 17233-17772/com.example.android.mediarecorder E/MediaRecorder﹕ start failed: -19
09-28 16:10:06.343 17233-17772/com.example.android.mediarecorder E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
Process: com.example.android.mediarecorder, PID: 17233
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at com.example.android.mediarecorder.MainActivity$MediaPrepareTask.doInBackground(MainActivity.java:208)
at com.example.android.mediarecorder.MainActivity$MediaPrepareTask.doInBackground(MainActivity.java:200)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
新增内容
另外,当我在AndroidManifest.xml中删除android:screenOrientation="landscape"
后,它仍然可以正常工作,但我不知道为什么?