使用 tcp/ip 在真实手机上使用 adb logcat

发布于 2024-10-04 07:54:45 字数 138 浏览 5 评论 0原文

我可以使用 adb 通过 wifi(使用 tcp/ip)从 Android 手机转储日志吗?可以使用 adb connect,但它需要在手机上运行一些服务器(在 5555 端口)。我如何启动这个服务器? 或者从手机获取日志的唯一方法是将其连接为 USB 设备?

Can I dump logs from an android phone over wifi (using tcp/ip) using adb? adb connect can be used, but it needs some server to be running on the phone (at 5555 port). How do I start this server?
Or the only way to get logs from a phone is by connecting it as a USB device?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一江春梦 2024-10-11 07:54:46

Zero4

您要做的就是在设备上删除 adb logcat 命令将输出流发送到远程位置。我建议,阅读这篇文章了解如何在您的应用程序中运行 shell 命令。

摘要是

  • 运行“adb logcat”
  • 在设备上的文件中收集命令的输出流
  • 。最后将该文件发布到本地服务器或手动从设备中提取该文件

帖子包含您要查找的所有内容的链接。

zero4

All you are trying to do is drop adb logcat command on the device & send output stream to a remote location. I would suggest, read this post about how to run shell commands in your app.

The summary is

  • Run "adb logcat"
  • Collect Output Stream of the command in a file on device
  • & Finally post that file to your local server OR Manually pull that file from device

The post contains link to everything you are looking for.

不忘初心 2024-10-11 07:54:46

Android在网络访问方面非常偏执。如果没有 root 访问权限,您就无法真正运行任何服务器,而只能运行客户端。总之,没有root,看100rabh的答案。

如果您确实拥有root权限,则可以打开网络堆栈以在端口5555上进行传入连接,或者您可以破解adb以进行反向连接(即连接到您的客户端)。后者更安全,而且应该不难做到。 (不过,我有一段时间没有查看代码了。)对于 adb 的所有三个部分(服务器、守护进程和客户端),adb 所有部分的通信位都在同一个库中处理。

顺便说一句,你所说的手机上的服务器实际上是adb守护进程。

Android is very paranoid when it comes to network access. Without root access, you can't really run any servers, just clients. In short, without root, look at the answer from 100rabh.

If you do have root, you could either open up your network stack for incoming connections on port 5555, or you could hack adb to do the inverse connection (that is, connect to your client). The latter is way more secure and shouldn't really be to hard to do. (I haven't looked at the code for a while, though.) The communication bits for all parts of adb is handled in one and the same library, for all three parts of adb (server, daemon and client).

By the way, what you refer to as a server on the phone is really the adb daemon.

失眠症患者 2024-10-11 07:54:45

在您的手机上安装 adbWireless。运行应用程序并单击大按钮(您不能错过它!)。它将通过 Wifi 激活 ADB 并显示用于通过 adb 命令连接到它的 URL。

在此处输入图像描述

在您的计算机上,使用 connect< 运行 adb 命令/代码> 参数。 adb 的用法是这样的:

 connect <host>[:<port>]       - connect to a device via TCP/IP
                                 Port 5555 is used by default if no port number is specified.

显然电脑和智能手机必须在同一个 Wifi 网络上。

Install adbWireless on your phone. Run the application and click on the big button (you cannot miss it!). It will activate ADB over Wifi and display the URL to use to connect to it with the adb command.

enter image description here

On your computer, run the adb command with the connect parameter. The usage for adb says:

 connect <host>[:<port>]       - connect to a device via TCP/IP
                                 Port 5555 is used by default if no port number is specified.

Obviously the computer and the smartphone must be on the same Wifi network.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文