I'm trying to change volume on my device via ADB.

When for instance running

adb shell media volume --stream 15 --set 0

...this error is returned (regarding the volume streams):

/system/bin/sh: media: inaccessible or not found

Oneplus 5T, LineageOS 18.1 (Android 11)

Android documentation

2 Answers 2


To send adb command to Android 11 or 12 devices, the syntax of controlling volume has changed:

adb shell cmd media_session volume --set 10

This is used to set the volume at 10 — just replace 10 with your desired value.

  • The index range appears to be between 0 and 25: Error: invalid volume index 60 for stream 3 (should be in [0..25])
    – user598527
    Commented Mar 22, 2023 at 12:58
  • output for $ cmd media_session volume --set 10: [V] will set volume to index=10 \ [V] Connecting to AudioService
    – user598527
    Commented Mar 22, 2023 at 13:02

In Android 11 and Android 12, media utility no longer exists. That's why you got the error since your shell could not find the utility in locations mentioned in its PATH. That utility's commands have been moved to a service name MediaSessionService. To access those commands invoke this service using cmd command.

adb shell cmd media_session


$ cmd media_session                                                                                                                           
usage: media_session [subcommand] [options]
       media_session dispatch KEY
       media_session dispatch KEY
       media_session list-sessions
       media_session monitor 
       media_session volume [options]

media_session dispatch: dispatch a media key to the system.
                KEY may be: play, pause, play-pause, mute, headsethook,
                stop, next, previous, rewind, record, fast-forword.
media_session list-sessions: print a list of the current sessions.
media_session monitor: monitor updates to the specified session.
                       Use the tag from list-sessions.
media_session volume:  the options are as follows: 
                --stream STREAM selects the stream to control, see AudioManager.STREAM_*
                                controls AudioManager.STREAM_MUSIC if no stream is specified
                --set INDEX     sets the volume index value
                --adj DIRECTION adjusts the volume, use raise|same|lower for the direction
                --get           outputs the current volume
                --show          shows the UI during the volume change
                adb shell media volume --show --stream 3 --set 11
                adb shell media volume --stream 0 --adj lower
                adb shell media volume --stream 3 --get

The examples section above has not been updated in the source code to reflect new changes, that's why it still recommends using media or adb shell media.

  • I still get the error when running media_session list-sessions: /system/bin/sh: media_session: inaccessible or not found. cmd media_session outputs the same info as in your answer body. Hopefully I didn't make any obvious mistake, I'll look more into this tomorrow
    – user598527
    Commented May 14, 2022 at 10:33
  • 2
    You have to use cmd before media_session. cmd utility is used to call shell commands offered by system services.
    – Firelord
    Commented May 14, 2022 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .