使用 tcp/ip 在真实手机上使用 adb logcat
我可以使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Zero4
您要做的就是在设备上删除
adb logcat
命令将输出流发送到远程位置。我建议,阅读这篇文章了解如何在您的应用程序中运行 shell 命令。摘要是
帖子包含您要查找的所有内容的链接。
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
The post contains link to everything you are looking for.
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.
在您的手机上安装 adbWireless。运行应用程序并单击大按钮(您不能错过它!)。它将通过 Wifi 激活 ADB 并显示用于通过
adb
命令连接到它的 URL。在您的计算机上,使用
connect< 运行
adb
命令/代码> 参数。 adb 的用法是这样的:显然电脑和智能手机必须在同一个 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.On your computer, run the
adb
command with theconnect
parameter. The usage for adb says:Obviously the computer and the smartphone must be on the same Wifi network.