Sunday, April 19, 2015

Remote Debugging and Installing to Android Emulator

Running an Android Emulator in my development laptop definitely slowing all the system.
I switched to vim instead of painful Android Studio IDE. My Laptop still slow.
So i came up with a solution that i could use my other laptop to run the android emulator.
The emulator now runs, with 5554:MyAvd-1 at the title.

Port forwarding in linux using ssh is really simple. I run
$ ssh adesanto@192.168.1.29 -L 5555:127.0.0.1:5554
$ killall adb; adb devices

The result is no device attached. Strange, i googled and end with
http://stackoverflow.com/questions/1754162/remote-debugging-with-android-emulator

I tried one of the answer from Christopher Orr,
  • ssh -NL 5556:localhost:5554 -L 5557:localhost:5555 myuser@remote-server
  • killall adb; adb devices
The result shows that there is a device at emulator-5556 but the status is offline.
After scroll down the answers i see that hheimbuerger, he forward mylaptop:5554 to target:5554
and  mylaptop:5555 to target:5555.

Aha! now after modify the tunnel and restart the adb process by
$ ssh -NL 5556:localhost:5554 -L 5557:localhost:5555 myuser@remote-server
$ killall adb; adb devices
I have my emulator list showing
List of devices attached
emulator-5554 device

Nice! i tried to run
$ adb logcat
It throws alot of messages at my screen showing it works!
Then i tried to upload one of my debug .apk, it uploads and running like charm.

Happy codding.

No comments: