Please indicate the source in the form of link:

This post is from the blog 103Style

Rising posture: one of AndroidStudio’s hidden skills is using Network profilers to view data related to Network requests.

Website links: developer.android.com/studio/prof…

The disadvantage is that there will not be a corresponding message display request failure, hurry up to give A suggestion to AndroidStudio, link address.

The document also says:

Currently, Network Profiler only supports the HttpURLConnection and OkHttp Network connection libraries.

Base on AndroidStudio 3.5.2 (available after 3.0)


rendering

Request time
Thread where
Request parameters
Response information


Operation method

Start by running the app on the phone, then click the Profiler Tab at the bottom of the AS.

If your AS does not have this TAB, you can open it in View → Tool Windows → Profiler.

By default, the app you are running is below SESSIONS in the upper left. If not, click + to the right of SESSIONS to add the corresponding process.

Then click the area where the Network is, and the display is as follows:

Where there is a peak value, there is traffic consumption. Then we can click the left button of the mouse to select the area to view and see the following interface:

Then we click on Thread View

orange
blue
xTID#1
The blue area
Request information returned successfully

Then we can see the content such as Response and Request related to the network Request.


Dynamic sample

So there are a lot of good things about checking official documents regularly.

Attach the relevant AndroidStudio documentation address (no need to go over the wall, and it is in Chinese) :

  • AndroidStudio user guide
  • Config compiler variant
  • Check CPU activity using CPU Profiler
  • Use Memory Profiler to view Java heap and Memory allocation
  • Use an Energy Profiler to check power consumption

Wait, there are many more interesting things to discover in the documentation above!


The above

If you like it, please give it a thumbs up.


Scan the qr code below, follow my public account Android1024, click attention, don’t get lost.