I'm using an evaluation board from Atmel (based on SAM D21 Cortex-M0+ MCU) for developing a custom Android USB accessory and related app.

I'm new to Android development, but I understood I need ADB connection for debugging: breakpoint, step into, step over, resume, and so on.

ADB is generally over USB, but the USB port is connected to the accessory. So it can't be used for debugging (I know Android device in USB accessory mode shows two endpoints, one for accessory and the other for ADB, but it will be very complex to manage this USB ADB by the accessory I'm designing). So I tried to establish an ADB connection over TCP/IP. After some issues with my network devices, I think it works now: I can set breakpoints, step into, and so on.

The problem raises when I plug the Android device to the USB accessory. Exactly in this moment, the ADB connection over TCP/IP to the device seems stopping immediately. After that, I can re-establish another ADB connection (with "adb connect" command), but it is very annoying. Everytime I restart the USB accessory software, it enumerates the Android device and put it in accessory mode, so the ADB over TCP/IP stops.

Maybe this happens because adbd running in the device listens to USB port, even if it was configured to listen to TCP/IP port. Is there a way to definitevely stop the USB listening of adbd?

Maybe is there another solution?

My app crashes immediately when the USB accessory is plugged. I can't debug what happens, because at the same moment the ADB connection over TCP/IP is lost and must be established again manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.