Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio network profiler

Is there a simple way to monitor network traffic with in Android Studio? I am looking for an equivalent of Firefox or Chrome's console where you can see REST HTTP calls: requests, responses and headers. I have tried the ADM (Android Device Monitor) and the "Network Statistics" but I don't see the detail of my HTTP calls.

like image 543
Moussa Avatar asked Jul 31 '17 08:07

Moussa


People also ask

How does Android Studio monitor network traffic?

From the Android Studio navigation bar, select View > Tool Windows > App Inspection. After the app inspection window automatically connects to an app process, select Network Inspector from the tabs.

Where is network Profiler Android Studio?

To open any Profiler, click anywhere on its respective row, where you'll see a more detailed view. Note: For Android Studio versions 2020.3. 1+, Network Profiler has been moved to App Inspector. To open the Network Profiler, go to View > Tool Windows > App Inspection and select Network Inspector from the tabs.

What is the use of Profiler in Android Studio?

The Android Profiler in Android Studio 3.0 and higher replaces the Android Monitor tools. The Android Profiler tools provide real-time data to help you to understand how your app uses CPU, memory, network, and battery resources.


2 Answers

According to the Android Official, it only works for the app using HttpURLConnection and OKHttp libraries. If you are using other network library or the legacy apache HttpClient. It is not available to capture the network traffic.

Network connection troubleshooting If the Network Profiler detects traffic values, but cannot identify any supported network requests, you will receive the following error message:

"Network Profiling Data Unavailable: There is no information for the network traffic you've selected."

Currently, the Network Profiler supports only the HttpURLConnection and OkHttp libraries for network connections. If your app uses another network connection library, you may not be able to view your network activity in the Network Profiler. If you have received this error message, but your app does use HttpURLConnection or OkHttp, please report a bug, or search the issue tracker to include your feedback in an existing report that's related to your issue. You can also use these resources to request support for additional libraries.

like image 71
Long Ranger Avatar answered Oct 07 '22 01:10

Long Ranger


Try Stetho from Facebook http://facebook.github.io/stetho/

Network Inspection

Network inspection is possible with the full spectrum of Chrome Developer Tools features, including image preview, JSON response helpers, and even exporting traces to the HAR format.

like image 36
Leanid Vouk Avatar answered Oct 07 '22 00:10

Leanid Vouk