将USB设备连接到Android仿真器 [英] Connecting USB Devices to Android Emulator

查看:116
本文介绍了将USB设备连接到Android仿真器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,android仿真器无法收听USB或主机的任何其他设备,因此我有一个问题:是否有任何方法可以模拟USB连接(或其他设备连接,如耳机或麦克风)?模拟器?也许通过adb或模拟器命令工具?或者也许有一种方法可以让仿真器查看连接到主机的设备(PC,Windows OS)?

From what I know, android emulator cannot listen to USB or any other devices of Hosting machine, and thus I have a question: Is there any way to emulate USB connections (or any other device connection like headphones or microphone) on an Emulator? Maybe through adb or emulator command tools? Or maybe there is a way to have the emulator see devices connected to the host (PC, Windows OS)?

我的应用程序具有一个选项菜单,其中列出了所有连接的音频设备,用户可以从该列表中进行选择.但是,对于Android TV,我正在使用仿真器,并且无法连接新设备对其进行测试.

My application has an option menu where all connected audio devices are listed, and the user can choose from this list. However, for Android TV I'm using an emulator and I can't connect new devices to test it out.

推荐答案

您是否在Ubuntu上使用模拟器?如果是,请尝试:

Do you use emulator on Ubuntu? If yes, try:

  1. 列出使用lsusb的USB设备,例如对于我的逻辑技术无线键盘和鼠标加密狗

Bus 002 Device 002: ID 0424:5744 Standard Microsystems Corp. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 023: ID 046d:c534 Logitech, Inc. Unifying Receiver

  1. 启动模拟器

sudo ./emulator @Pixel_XL_API_Q -kernel /home/robot/Android/goldfish/arch/x86/boot/bzImage  -qemu -usb -device usb-host,hostbus=1,hostaddr=23

  1. 现在您可以将键盘和鼠标切换到仿真器

对我有用

https://www.linux-kvm.org/page/USB_Host_Device_Assigned_to_Guest

将为您提供一些信息.

这篇关于将USB设备连接到Android仿真器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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