Closed hannesa2 closed 1 year ago
AudioRecord.Builder.build()
throws an UnsupportedOperationException
.
It is expected on Android 11 when the shell application is not foreground when you start, but not on Android 12.
Just in case, unlock your device, execute:
adb shell am start -n com.android.shell/.HeapDumpActivity
It should open a popup. While the popup is visible, start scrcpy. Does it solve the problem?
I see this dialog
means "Share heap dump? The memory limit of 0.00 was exceeded for the process "null". A heap dump is available to share with the developer. However, it is important to note that the heap dump may contain personal information about you that the app can access."
Unfortunately , scrcpy
still shows the same error
[server] ERROR: Exception on thread Thread[Thread-4,5,main]
java.lang.UnsupportedOperationException: Cannot create AudioRecord
at android.media.AudioRecord$Builder.build(AudioRecord.java:913)
at com.genymobile.scrcpy.AudioCapture.createAudioRecord(AudioCapture.java:58)
at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:90)
at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:183)
at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:120)
at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:920)
INFO: Renderer: metal
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Initial texture: 1920x960
OK, so that's not the same cause as on Android 11. You must find in your ROM why building an AudioRecord throws an UnsupportedOperationException
. On Android 12, it is not expected to happen (AOSP or vendor ROMs).
UnsupportedOperationException if the parameters set on the Builder were incompatible, if the parameters are not supported by the device, if the caller does not hold the appropriate permissions, or if the device was not available.
https://developer.android.com/reference/android/media/AudioRecord.Builder#build()
Ok, I guess it's on my side. I close it, Thank you !
Hello @hannesa2, I am experiencing the same issue with my own build of AOSP and I was wondering if you managed to resolve it in the end? Thanks 🙂
Sorry, no
When I start scrcpy all works fine, expect audio
Demuxer 'audio': stream explicitly disabled by the device
does someone knows how to enable it. It's an own build of AOSPBtw, thank you for this cool tool !