Running Android emulator with -noaudio option returns "qemu-system-i386.exe: -audio: invalid option"

android, android-emulator, android-virtual-device, audio, sdk

Solution

I have tested this on Linux. (For windows checkout comments or @Tekk answer) If you don't want audio simply use:

export QEMU_AUDIO_DRV=none && emulator -avd Nexus_4

TL;DR

Quote from here

Based on some digging around, it looks like QEMU2 removed the ability to completely disabled audio - you can specify which sound card the audio goes through, but can't turn it off altogether. The "-audio" flag was replaced with "-soundhw", which lets us specify which sound card to use.

QEMU1 (using the "-engine classic" emulator command line flag) does work when "-noaudio" is passed), but passing "-soundhw none" to QEMU2 also fails.

Solution:

Post about emulated audio devices

On linux if I want sound I use:

export QEMU_AUDIO_DRV=pa && emulator.orig -avd Nexus_S_api_23

It works fine. Also I don't have 100% CPU usage

My snippet:

#!/bin/bash
# http://stackoverflow.com/a/35822173/1052261
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

#echo "DIR is '$DIR'"
#If you want audio pass QEMU_AUDIO_DRV=pa -> https://www.wagner.pp.ru/fossil/vws/wiki?name=QEMU+audio
export QEMU_AUDIO_DRV=none && $DIR/emulator.orig -use-system-libs "$@" -qemu -m 512 -enable-kvm

Simply replace `Android-sdk/tools/emulator` to `Android-sdk/tools/emulator.orig` Then create script with above source in `Android-sdk/tools/emulator` (Allow for execution).

Remember sometimes when android sdk will upgrade it will remove this script ;)

Problem

- I'm running Windows 10, 64 bit, Android Studio 2.2.2. When creating an AVD from the Android SDK's AVD Manager, I don't see an option to completeley disable audio (input and output). I'm using Android SDK which has verion of Android Tools 25.2.2). In older AVD manager, i recall that option to completely disable audio on AVD was present. - When I want to create a batch script, to run with `-noaudio` option, as mentioned in the Google's official Control the Emulator from the Command Line page, I'm running the command as `emulator.exe -avd Nexus_4 -noaudio`, but it throws error `qemu-system-i386.exe: -audio: invalid option` - Android Emulator dialog opens, with indeterminate progress bar, and the AVD doesn't start at all. Keeps loading forever. Any help is appreciated.

Original source

Related problems