android – 如何在连接到远程系统的设备上部署和执行应用程序?

前端之家收集整理的这篇文章主要介绍了android – 如何在连接到远程系统的设备上部署和执行应用程序?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要部署测试应用程序并在连接到同一网络中另一台计算机的设备上发出命令.

我读了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:

  1. 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.
  2. 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.
  3. 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

现在,您可以强制本地系统上的adb使用其他(远程)服务器,而不是通过预先添加-H< REMOTE_IP>来启动其自己的(本地)实例. -P< PORT_NUMBER>到您的adb命令:

adb -H <REMOTE_IP> -P <PORT_NUMBER> devices

或者设置ANDROID_ADB_SERVER_ADDRESS =< REMOTE_IP>和ANDROID_ADB_SERVER_PORT =< PORT_NUMBER>客户端的环境变量可以让你避免必须指定< REMOTE_IP>和< PORT_NUMBER>对于每个ad​​b命令.

如果省略< PORT_NUMBER>默认为5037.

原文链接:https://www.f2er.com/android/309892.html

猜你在找的Android相关文章