-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
Any help is appreciated.
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 ;)
Thanks to @Dawid Drozd's answer, I've created a Windows batch script that will run AVD without sound input/output. Just give the script a parameter of AVD name.
The trick is to run set QEMU_AUDIO_DRV=none
before executing AVD.
@echo off
if "%1"=="" goto usage
set QEMU_AUDIO_DRV=none
@echo Running AVD "%1" without sound...
@echo.
%ANDROID_HOME%\tools\emulator.exe -avd %1
goto :eof
:usage
@echo.
@echo -----------------------------------
@echo Usage: %0 ^<avd-name^>
@echo -----------------------------------
@echo.
@timeout 3 >0
exit /B 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With