简体   繁体   中英

Debugging physical USB Device in Android Emulator

Note: The closest other question I've found is here . The reason I'm asking something similar is because six years have passed since that question was asked, and Android has advanced quite a bit in that time.

I'm writing an Android app that interfaces with a USB device, and I need to see debugger information when the two interact. I can connect my physical Android phone to my development machine via USB to view debugging info in logcat, or I can connect the phone to the USB device, but obviously not both at the same time.

I'm open to other solutions, but is there currently a way to make an Android Virtual Device recognize a physical USB device?

Developing on Windows 10 64-bit with Android Studio 2.3.3. The development machine does not have Wi-Fi capabilities, as per company policy. If there are answers for other operating systems, or involving wireless connectivity please share them anyway, as they may help others in the future.

I can connect my physical Android phone to my development machine via USB to view debugging info in logcat, or I can connect the phone to the USB device, but obviously not both at the same time.

The typical solution would be to use adb over WiFi , so your Android phone's USB port is free.

If your phone has a USB-C port, it's conceivable that you could use a USB-C hub. I have never tried this.

You could use a Raspberry Pi running Android Things as your Android test environment, setting up adb over Ethernet (same approach as over WiFi) and using the Pi's USB ports for the device. Android Things isn't exactly the same as Android on mobile devices, but it may be close enough for your use case.

You could try other Android hardware that offers an Ethernet port plus USB (eg, Amazon Fire TV, Samsung Galaxy S8 in a DeX dock) or offers separate USB host and USB accessory ports.

but is there currently a way to make an Android Virtual Device recognize a physical USB device?

Not that I am aware of.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM