n1kh1lp
n1kh1lp

Reputation: 14295

adb logcat on a real phone using tcp/ip

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?

Upvotes: 4

Views: 9222

Answers (3)

Snark
Snark

Reputation: 163

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.

Upvotes: 4

Robert
Robert

Reputation: 7053

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.

Upvotes: 0

100rabh
100rabh

Reputation: 6186

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.

Upvotes: 0

Related Questions