Firebase Performance Monitoring and Retrofit
Asked Answered
M

1

8

I have integrated Firebase Performance Monitoring in one of my projects. In that project, I use Retrofit to manage my network requests.

Sadly, none of the requests made through Retrofit are visible in the "Network Requests" tab of Firebase Performance.

Here are the only things I see :

Firebase Performance Monitoring

Can somebody tell me what I need to do in order to see my Retrofit-managed network requests in Firebase Performance?

Thank you

Moralist answered 4/1, 2018 at 22:6 Comment(2)
What version of retrofit and okhttp are you using?Delrio
I currently use Retrofit 1.9.0 with OkHttp 2.4.0 I'll update both of them and see if the problem is solved.Moralist
L
11

Just started reading up on this - sounds interesting. Check that;

  1. You are using a supported OkHttp RE:

Performance Monitoring only supports monitoring HTTP/S network requests made using the OkHttp HTTP client version 3.x.x.

Retrofit 1, the original can use OkHttp 1 or 2 if I remember correctly. However, Retrofit 2 enforces 3.x.x+. Check which is pulled in by running ./gradlew <insert-module-name>:dependencies

  1. You've waited for 12hrs (Looking at the date-times I think you're good there!)
  2. If (1) and (2) don't help - then debug using the approach described in the documentation and adding this to the relevant AndroidManifest.xml;

    < meta-data android:name="firebase_performance_logcat_enabled" android:value="true" / >

...dumps what's going on to logcat by the sounds of it. Report back! My bets are on (1).

Lithology answered 4/1, 2018 at 22:58 Comment(4)
Thanks for your response. I currently use Retrofit 1.9.0 with OkHttp 2.4.0 I'll update both of them and see if the problem is solved.Moralist
Big update that one... Retrofit 1.9 --> latest! Good luck!Lithology
Actually, it was such a big work to upgrade Retrofit and OkHttp in the project that we decided to do it later. So I can't say :/Moralist
I have upgraded Retrofit in my project and now I see everything in Firebase Performance. Thanks :)Moralist

© 2022 - 2024 — McMap. All rights reserved.