与Android模拟器进行远程调试 [英] Remote debugging with Android emulator

查看:121
本文介绍了与Android模拟器进行远程调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能写的code /它在远程对另一个发射模拟器编译Android应用程序在一台计算机和调试?我厌倦了仿真器不断蚕食一半我的笔记本电脑的CPU的。

Is it possible to write the code/compile Android application on one machine and debug it remotely on the emulator launched on another? I'm sick and tired of the emulator constantly eating half of my laptop's CPU.

推荐答案

我还没有previously尝试(甚至注意到)的 ADB连接命令中巴提及,但我可以证实,转发自己和mdash的TCP端口;如通过SSH—工作得很好。

I haven't previously tried (or even noticed) the adb connect command that cmb mentioned, but I can confirm that forwarding the TCP ports yourself — such as over SSH — works fine.

仿真器监听每个实例两个TCP端口:5554为Telnet接口和5555使用诸如DDMS工具控制通信。所以,你很可能逃脱只有转发端口5555(虽然我只试了一下,到目前为止既)。以后每次仿真器将在下一次甚至可用+奇数端口号元组(最多5580左右,我认为)。

The emulator listens on two TCP ports per instance: 5554 for the telnet interface and 5555 for control communication with tools like DDMS. So you could probably get away with only forwarding port 5555 (though I've only tried it so far with both). Each subsequent emulator takes the next available even+odd port number tuple (up to around 5580, I think).

有关的参考,我做我的本地机器下面的步骤:

For reference, I did the following steps on my local machine:

  • SSH -NL 5556:本地主机:5554 -L 5557:本地主机:5555 myuser的@远程服务器
  • killall亚行; ADB设备
  • ssh -NL 5556:localhost:5554 -L 5557:localhost:5555 myuser@remote-server
  • killall adb; adb devices

我相信模拟器尝试在启动时通知本地ADB服务器;因此有必要重新启动亚行,以便它探测本地5554+端口

I believe the emulator tries to notify a local adb server at startup; hence the need to restart adb in order for it to probe the local 5554+ ports.

请注意,我是在本地运行模拟器太,所以我不得不在SSH命令中使用5556此外,本地主机指的是远程的机器。

Note that I was running an emulator locally too, hence I had to use 5556. Also, the localhost in the ssh command refers to the local interface of the remote machine.

ADB设备显示一个新的模拟器— 模拟器-5556 —我可以使用它,就好像它是在我的本地机器上运行。

adb devices showed a new emulator — emulator-5556 — and I could use it as if it were running on my local machine.

这篇关于与Android模拟器进行远程调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆