Search code examples
androidazureadbremote-desktopportforwarding

Android development is in VM but need to deploy & debug in local device


I am doing an Android app by connecting to a Virtual machine in Azure cloud by connecting to it via RDP(Remote Desktop Protocol). One week ago I was doing my development in local machine but my machine crashed so I started working in cloud. Back then, working with my local machine I had these privileges

1)Using of 'use Host GPU' option while creating an Android Virtual Device 2) Use of HAXM or intel virtualization technology/Hypr-v as I had access to my BIOS to set that up.

And I have a Google nexus 7 device and I used to work with it when ever emulators cannot do the job.(Like taking a picture for real)

Remote VM, I have no access to BIOS in Azure so I cannot make use of HAXM to speed up my emulator and of course I cannot use HOST GPU option while creating the AVD. It takes a long time to fire up the emulator and to deploy again and again. (My VM is a Azure D4 with 8 cores and 28 gigs of RAM)

I need to find out a way to forward my adb port to local machine so I can deploy apk into local device but yet developing from the cloud.

I went through following links but did not have anything working for 4 days now. I am stuck with my development totally until I get a new machine. Can someone please help on debugging locally

Usb data cable comunication in Android

adb forward remote port to local machine

https://bitbucket.org/chabernac/adbportforward/wiki/Home

Especially if any of you have configured the third link (chabernac's adbportforward) please help me by stating how to do it.


Solution

  • Both vm and mobile device should be on the same net to work flawlessly

    Just plug your device via usb on localmachine and in terminal type

    1. adb tcpip 5555 (or the port you want to use)

    unplug your phone, test if you connect to the device

    1. adb connect <device ip>

    then

    1. adb devices

    it should show the device you're connected to

    Now type this to disconnect from the device

    1. adb disconnect

    go to %HOMEPATH%\.android and copy the rsa keys:

    • adbkey
    • 2adbkey.pub

    Go on remote machine and paste those two files to the same path.

    Repeat step 2 and 3 to check if the device is connected

    This works on devices 4.2+

    This is the article which helped me a lot http://www.cleansoft.lv/debugging-android-applications-remotely/