我需要部署测试应用程序并在连接到同一网络中另一台计算机的设备上发出命令.
我读了http://developer.android.com/tools/help/adb.html#directingcommands,但我找不到答案.
我尝试过使用adb connect< remote machine IP>但我无法连接错误.
有没有办法在连接到远程系统的设备上部署应用程序并执行adb命令?
解决方法
来自adb
tag wiki:
Android Debug Bridge (adb) is a versatile command line tool that lets
you communicate with an emulator instance or connected Android-powered
device. It is a client-server program that includes three components:
- A client,which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
- A server,which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
- A daemon,which runs as a background process on each emulator or device instance.
adb connect命令用于将本地服务器与网络连接设备上的守护程序连接.但您想要的是将本地客户端连接到远程服务器.为此,您需要在本地和远程系统上安装最新的adb版本.
使用以下命令在远程系统上启动adb服务器实例(您将插入设备的实例):
adb -a -P <PORT_NUMBER> nodaemon server@H_502_31@现在,您可以强制本地系统上的adb使用其他(远程)服务器,而不是通过预先添加-H< REMOTE_IP>来启动其自己的(本地)实例. -P< PORT_NUMBER>到您的adb命令:
adb -H <REMOTE_IP> -P <PORT_NUMBER> devices@H_502_31@或者设置ANDROID_ADB_SERVER_ADDRESS =< REMOTE_IP>和ANDROID_ADB_SERVER_PORT =< PORT_NUMBER>客户端的环境变量可以让你避免必须指定< REMOTE_IP>和< PORT_NUMBER>对于每个adb命令.
如果省略< PORT_NUMBER>默认为5037.