continuous-audiorecorder icon indicating copy to clipboard operation
continuous-audiorecorder copied to clipboard

Handle java.lang.RuntimeException: An error occurred while uting doInBackground() Exception

Open sahifedp opened this issue 6 years ago • 13 comments

Hi My app use ACRA crash report this Exception reported several times: Please handle this exception. thanks.

java.lang.RuntimeException: An error occurred while uting doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) 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$Serialutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolutor.runWorker(ThreadPoolutor.java:1113) at java.util.concurrent.ThreadPoolutor$Worker.run(ThreadPoolutor.java:588) at java.lang.Thread.run(Thread.java:818)nCaused by: java.util.NoSuchElementException at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:59) at java.util.AbstractCollection.toArrayList(AbstractCollection.java:349) at java.util.AbstractCollection.toArray(AbstractCollection.java:339) at java.util.ArrayList.addAll(ArrayList.java:188) at com.googlecode.mp4parser.authoring.tracks.AppendTrack.getSamples(AppendTrack.java:357) at com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder.build(DefaultMp4Builder.java:92) at com.github.lassana.recorder.Mp4ParserWrapper.append(Mp4ParserWrapper.java:105) at com.github.lassana.recorder.Mp4ParserWrapper.append(Mp4ParserWrapper.java:48) at com.github.lassana.recorder.AudioRecorder.appendToFile(AudioRecorder.java:287) at com.github.lassana.recorder.AudioRecorder.access$900(AudioRecorder.java:18) at com.github.lassana.recorder.AudioRecorder$PauseRecordTask.doInBackground(AudioRecorder.java:131) at com.github.lassana.recorder.AudioRecorder$PauseRecordTask.doInBackground(AudioRecorder.java:117) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237)n ... 4 morenjava.util.NoSuchElementException at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:59) at java.util.AbstractCollection.toArrayList(AbstractCollection.java:349) at java.util.AbstractCollection.toArray(AbstractCollection.java:339) at java.util.ArrayList.addAll(ArrayList.java:188) at com.googlecode.mp4parser.authoring.tracks.AppendTrack.getSamples(AppendTrack.java:357) at com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder.build(DefaultMp4Builder.java:92) at com.github.lassana.recorder.Mp4ParserWrapper.append(Mp4ParserWrapper.java:105) at com.github.lassana.recorder.Mp4ParserWrapper.append(Mp4ParserWrapper.java:48) at com.github.lassana.recorder.AudioRecorder.appendToFile(AudioRecorder.java:287) at com.github.lassana.recorder.AudioRecorder.access$900(AudioRecorder.java:18) at com.github.lassana.recorder.AudioRecorder$PauseRecordTask.doInBackground(AudioRecorder.java:131) at com.github.lassana.recorder.AudioRecorder$PauseRecordTask.doInBackground(AudioRecorder.java:117) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$Serialutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolutor.runWorker(ThreadPoolutor.java:1113) at java.util.concurrent.ThreadPoolutor$Worker.run(ThreadPoolutor.java:588) at java.lang.Thread.run(Thread.java:818)

sahifedp avatar Nov 15 '17 01:11 sahifedp

I'm getting this error too.

abhnerAraujo avatar Dec 28 '17 19:12 abhnerAraujo

Anyone have a fix for this yet?

kkl260 avatar Sep 20 '18 13:09 kkl260

@lassana If you can able to provide a solution for this, it will be be very helpful, my whole app is made upon on this, now changing this will cost me a lot, app is crashing a lot only due to this. Mostly in Samsung devices.

Caused by java.lang.IllegalStateException at android.media.MediaRecorder._start(MediaRecorder.java) at android.media.MediaRecorder.start(MediaRecorder.java:1170) at com.github.lassana.recorder.AudioRecorder$StartRecordTask.doInBackground(SourceFile:90) at com.github.lassana.recorder.AudioRecorder$StartRecordTask.doInBackground(SourceFile:79) 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)

sachinvarma avatar Oct 31 '18 15:10 sachinvarma

@sachinvarma I suppose you should use a different audio recording configuration to avoid this. It would be helpful if you provided steps to reproduce the crash.

lassana avatar Oct 31 '18 15:10 lassana

Hi,

Thanks for the reply, just tried to record it from samsung mobile, it simply crashed, crash is on mediaRecorder.start(), and it is happening only in Samsung devices.

Regards, Sachin Varma

On Wed, 31 Oct 2018, 9:37 pm Mikalai Daronin <[email protected] wrote:

@sachinvarma https://github.com/sachinvarma I suppose you should use a different audio recording configuration to avoid this. It would be helpful if you provided steps to reproduce the crash.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lassana/continuous-audiorecorder/issues/24#issuecomment-434743928, or mute the thread https://github.com/notifications/unsubscribe-auth/AXcmMltvPuowjJ2MpeJ_Q1_Zx8nU15CIks5uqcrEgaJpZM4QeRxr .

sachinvarma avatar Oct 31 '18 16:10 sachinvarma

Unfortunately, I don't have any Samsung device. I'd suggest to try different output configurations.

lassana avatar Oct 31 '18 16:10 lassana

Sure, thanks for the reply.

On Wed, 31 Oct 2018, 10:12 pm Mikalai Daronin <[email protected] wrote:

Unfortunately, I don't have any Samsung device. I'd suggest to try different output configurations https://github.com/lassana/continuous-audiorecorder/blob/d2aa129e0a801d66ab72bea90fb3b7422175dc99/recorder/src/main/java/com/github/lassana/recorder/AudioRecorder.java#L207-L219 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lassana/continuous-audiorecorder/issues/24#issuecomment-434756979, or mute the thread https://github.com/notifications/unsubscribe-auth/AXcmMgIjtp9dhcoYW9enbr_qW5-Ll_Xkks5uqdMAgaJpZM4QeRxr .

sachinvarma avatar Oct 31 '18 17:10 sachinvarma

Hi,

"MediaRecorder.AudioSource.MIC" played the role, now it is working in Samsung also. Really appreciating your swift reply.

Regards Sachin Varma

On Wed, 31 Oct 2018, 10:49 pm Sachin Varma < [email protected] wrote:

Sure, thanks for the reply.

On Wed, 31 Oct 2018, 10:12 pm Mikalai Daronin <[email protected] wrote:

Unfortunately, I don't have any Samsung device. I'd suggest to try different output configurations https://github.com/lassana/continuous-audiorecorder/blob/d2aa129e0a801d66ab72bea90fb3b7422175dc99/recorder/src/main/java/com/github/lassana/recorder/AudioRecorder.java#L207-L219 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lassana/continuous-audiorecorder/issues/24#issuecomment-434756979, or mute the thread https://github.com/notifications/unsubscribe-auth/AXcmMgIjtp9dhcoYW9enbr_qW5-Ll_Xkks5uqdMAgaJpZM4QeRxr .

sachinvarma avatar Oct 31 '18 18:10 sachinvarma

@sachinvarma thanks for sharing, but could you explain a bit more please?

Did you change this line: MediaRecorder.AudioSource.DEFAULT into this: MediaRecorder.AudioSource.MIC and was that enough for you? I've tried it but the crash is still occurring for Samsung devices.

Would you perhaps mind to share your output configuration such as bitrate, output format and encoder? This crash is happening a lot in my app too, I'd love to fix it.

netunlimited avatar Nov 20 '18 08:11 netunlimited

No i did more, @netunlimited Could you please try this,
implementation "com.github.sachinvarma:continuous-audiorecorder:v1.3.3.3" and let me know whether it works for you or not.

On Tue, 20 Nov 2018, 1:57 pm netunlimited <[email protected] wrote:

@sachinvarma https://github.com/sachinvarma thanks for sharing, but could you explain a bit more please?

Did you change this line: MediaRecorder.AudioSource.DEFAULT into this: MediaRecorder.AudioSource.MIC and was that enough for you? I've tried it but the crash is still occurring for Samsung devices.

Would you perhaps mind to share your output configuration such as bitrate and encoder? This crash is happening a lot in my app too, I'd love to fix it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lassana/continuous-audiorecorder/issues/24#issuecomment-440185492, or mute the thread https://github.com/notifications/unsubscribe-auth/AXcmMkswabceMmyWA-jWnjeO1xv1ets8ks5uw7ztgaJpZM4QeRxr .

sachinvarma avatar Nov 20 '18 08:11 sachinvarma

No i did more, @netunlimited Could you please try this, implementation "com.github.sachinvarma:continuous-audiorecorder:v1.3.3.3" and let me know whether it works for you or not.

@sachinvarma Thank you so much, I will launch an update and see if the crash is fixed for my users. I will let you know.

netunlimited avatar Nov 20 '18 09:11 netunlimited

Me too getting this error. any fix?

qadirsuh avatar Oct 12 '21 14:10 qadirsuh

No i did more, @netunlimited Could you please try this, implementation "com.github.sachinvarma:continuous-audiorecorder:v1.3.3.3" and let me know whether it works for you or not.

@sachinvarma can you please tell me is it working still?

I have tried using different config combinations with no luck.

val mediaConfig = MediaRecorderConfig(
        64 * 1024,
        2,
        MediaRecorder.AudioSource.MIC,
        ApiHelper.DEFAULT_AUDIO_ENCODER
    )

mAudioRecorder = AudioRecorderBuilder.with(mApplication)
                .fileName(getNextFileName())
                .config(mediaConfig)
                .loggable()
                .build()

its getting crashed every time. :(

qadirsuh avatar Oct 12 '21 14:10 qadirsuh