使用-noaudio选项运行Android模拟器会返回"qemu-system-i386.exe:-audio:无效选项"; [英] Running Android emulator with -noaudio option returns "qemu-system-i386.exe: -audio: invalid option"

查看:176
本文介绍了使用-noaudio选项运行Android模拟器会返回"qemu-system-i386.exe:-audio:无效选项";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我正在运行Windows 10(64位),Android Studio 2.2.2.从Android SDK的AVD管理器创建AVD时,我看不到完全禁用音频(输入和输出)的选项.我正在使用Android SDK(版本为Android Tools 25.2.2)的Android SDK.在较早的AVD管理器中,我记得有一个选项可以完全禁用AVD上的音频.
  2. 当我要创建批处理脚本时,请使用-noaudio选项运行,如Google官方
  1. 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.
  2. 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

  1. Android Emulator对话框随即打开,带有不确定的进度条,并且AVD根本不会启动.永远保持加载状态.

感谢您的帮助.

推荐答案

我已经在Linux上对此进行了测试. (对于Windows Checkout注释或@Tekk答案)
如果您不想音频,只需使用:

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

从此处引用

基于一些挖掘,看来QEMU2取消了完全禁用音频的功能-您可以指定音频通过的声卡,但不能完全将其关闭.所述音频"包括:标记被替换为"-soundhw",它使我们可以指定要使用的声卡.

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(使用"-engine classic"仿真器命令行标志)在"-noaudio"菜单中起作用. ),但传递"-soundhw none"; QEMU2也失败.

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

解决方案:

关于模拟音频设备的帖子

在Linux上,如果我想要声音,我会使用:

On linux if i want sound i use:

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

工作正常.另外我没有100%的CPU使用率

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

我的代码段:

#!/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

只需将Android-sdk/tools/emulator替换为Android-sdk/tools/emulator.orig 然后在Android-sdk/tools/emulator中使用上述源代码创建脚本(允许执行).

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).

请记住,有时当android sdk升级时,它将删除此脚本;)

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

这篇关于使用-noaudio选项运行Android模拟器会返回"qemu-system-i386.exe:-audio:无效选项";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆