Runtime error setAudioSource failed. In audio recording app

When I use my app using the AI2 Companion and when I press Record it works fine and the audio saves in this path: /storage/emulated/0/Music/Recording1.3gp
But when I download it in my tablet, and press record it says: Runtime error setAudioSource failed.
Thank you.

This are the blocks I used

Have you asked for record audio permission?

Your blocks look fine. It should work with the APK as well (even on Android 11 devices, at least until July 2021).

The permissions (WRITE_EXTERNAL_STORAGE and RECORD_AUDIO) are requested automatically by the Sound_Recorder component.

Device name / model and Android version?

Usually that error which is also known as Illegal State exception is thrown when either media recorder has not been initialised or required permissions are missing.
There looks no other reason which can raise the exception.

Yes, may be, but both permissions are requested automatically as I said.

And how do I do that?
Before starting the app, it only asks for permission to access the photos, media, and files. (that might be because I have a button that browse the files in the device

The device is running the version of Android 7.1

Uninstall and reinstall the app.
When you start the app make screenshots, when you are asked for granting permissions and post these screenshots (incl. the error).

Ok. Here they are:
This is when the app starts after downloading

And this is when pressing the record button.

Post the aia (or send it to me privately via PM).

Here you go:
AudioRec.aia (214.9 KB)

Disable these 2 blocks, build the APK and try.
So this has nothing to do with the Sound_Recorder permissions, as I said.

1 Like

Ok, thanks it is now recording!
But why was the Voice level making the app to say that error?

this is an extension from @Juan_Antonio, he might know more...

1 Like