android / media-samples

Multiple samples showing the best practices in media APIs on Android (audio, video, etc.).
Apache License 2.0
1.27k stars 740 forks source link

Need camera permission #34

Open Capotasto opened 7 years ago

Capotasto commented 7 years ago
11-24 16:19:54.603 18488-26881/com.example.android.mediarecorder E/AndroidRuntime: FATAL EXCEPTION: AsyncTask android/android-MediaRecorder#1
                                                                                   Process: com.example.android.mediarecorder, PID: 18488
                                                                                   java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                                       at android.os.AsyncTask$3.done(AsyncTask.java:318)
                                                                                       at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                                                                                       at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                                                                                       at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                                       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
                                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                                       at java.lang.Thread.run(Thread.java:762)
                                                                                    Caused by: java.lang.RuntimeException: Fail to connect to camera service
                                                                                       at android.hardware.Camera.<init>(Camera.java:519)
                                                                                       at android.hardware.Camera.open(Camera.java:379)
                                                                                       at com.example.android.common.media.CameraHelper.getDefaultCameraInstance(CameraHelper.java:103)
                                                                                       at com.example.android.mediarecorder.MainActivity.prepareVideoRecorder(MainActivity.java:142)
                                                                                       at com.example.android.mediarecorder.MainActivity.access$000(MainActivity.java:44)
                                                                                       at com.example.android.mediarecorder.MainActivity$MediaPrepareTask.doInBackground(MainActivity.java:218)
                                                                                       at com.example.android.mediarecorder.MainActivity$MediaPrepareTask.doInBackground(MainActivity.java:213)
                                                                                       at android.os.AsyncTask$2.call(AsyncTask.java:304)
                                                                                       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 
                                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
                                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
                                                                                       at java.lang.Thread.run(Thread.java:762)