Issue
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.
Solution
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 (e.g., 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.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.