Comments (17)
You need to pass the client (with interceptors) into the RestAdapter Builder:
setClient(new OkClient(okHttpClient))
should read:
setClient(client)
from stetho.
@fingertricks, that's exactly how it works. I just use dagger, so client just returned from @provides method. And Injects as okHttpClient.
I can't use setClient(client), as Retrofit requires OkClient, inside it I can pass my custom OkHttpClient.
from stetho.
Are you using Retrofit <= 1.8? According to
https://github.com/square/okhttp/wiki/Interceptors, it won't work on that older version without some additional effort.
from stetho.
The Interceptors he is using were not available in Retrofit 1.8.
I'm having the same issue. In the logs I see:
W/System.err﹕ java.io.IOException: Address already in use
W/System.err﹕ at android.net.LocalSocketImpl.bindLocal(Native Method)
W/System.err﹕ at android.net.LocalSocketImpl.bind(LocalSocketImpl.java:303)
W/System.err﹕ at android.net.LocalServerSocket.(LocalServerSocket.java:52)
W/System.err﹕ at com.facebook.stetho.server.LocalSocketHttpServer.bindToSocket(LocalSocketHttpServer.java:278)
W/System.err﹕ at com.facebook.stetho.server.LocalSocketHttpServer.listenOnAddress(LocalSocketHttpServer.java:138)
W/System.err﹕ at com.facebook.stetho.server.LocalSocketHttpServer.run(LocalSocketHttpServer.java:134)
W/System.err﹕ at com.facebook.stetho.Stetho$1.run(Stetho.java:80)
E/stetho﹕ Could not bind to socket.
from stetho.
@antonkrasov let me spin up a quick Retrofit 1.9 + OkHttp 2.2.0 sample app to see if I can debug through the problems locally.
@Tremelune that error is unrelated (but still a bug). It's a harmless issue but is unintentionally noisy. I'll fix it soon.
from stetho.
@jasta wow, thanks! I really forgot to update Retrofit, updated OkHttp to 2.2.0, but continue using Retrofit 1.7.0
from stetho.
Same issue, with OkHttp 2.2.0 and Retrofit 1.9.
from stetho.
@Tremelune, seems like I need to reopen then.
from stetho.
@Tremelune I tested this locally and cannot see an issue with Retrofit 1.9. Can you try adding the logging interceptor mentioned in https://github.com/square/okhttp/wiki/Interceptors. I'm curious if that is working. If no, I think your issue is just with interceptors in general.
from stetho.
Yup, I'll see what I can do. I'm hoping for the ol' "clean build" fix...
from stetho.
Updating Retrofit to 1.9.0 didn't help, trying to add logging interceptor.
from stetho.
@jasta LoggingInterceptor from https://github.com/square/okhttp/wiki/Interceptors works fine for me. But Network tab still doesn't show anything.
from stetho.
I confirmed my sample app is working correctly with Retrofit 1.9 and OkHttp 2.2.0. Source is here: https://github.com/jasta/retrofit-okhttp-stetho-demo
Here's the modified GitHubClient
: https://github.com/jasta/retrofit-okhttp-stetho-demo/blob/master/app/src/main/java/com/example/retrofit/GitHubClient.java
from stetho.
@jasta cloning your demo app :) will check it now
from stetho.
@jasta yeah, your demo app works for me. Hmm, let me compare with my project and try to find the reason.
from stetho.
@jasta Wooohoo, thank you :) I found the issue, and it's quite simple: Proguard.
I fixed this for my project by adding:
-keep class com.facebook.stetho.**{ *; }
from stetho.
W/System.err﹕ java.io.IOException: Address already in use
W/System.err﹕ at android.net.LocalSocketImpl.bindLocal(Native Method)
W/System.err﹕ at android.net.LocalSocketImpl.bind(LocalSocketImpl.java:254)
W/System.err﹕ at android.net.LocalServerSocket.<init>(LocalServerSocket.java:52)
W/System.err﹕ at com.facebook.stetho.server.LocalSocketHttpServer.bindToSocket(LocalSocketHttpServer.java:278)
W/System.err﹕ at com.facebook.stetho.server.LocalSocketHttpServer.listenOnAddress(LocalSocketHttpServer.java:138)
W/System.err﹕ at com.facebook.stetho.server.LocalSocketHttpServer.run(LocalSocketHttpServer.java:134)
W/System.err﹕ at com.facebook.stetho.Stetho$1.run(Stetho.java:80)
Just run https://github.com/jasta/retrofit-okhttp-stetho-demo
from stetho.
Related Issues (20)
- A potential null pointer dereference bug. Please confirm, much appreicated! HOT 1
- Database Inspection Loading Blank Page HOT 1
- dumpapp commands are failing when more than 1 device is connected HOT 2
- 看不见包名 HOT 1
- Unreleased Resource: Streams
- Double-Checked Locking
- it seems Facebook is collecting device data even it is initialised in debug mode
- Stetho protobufs - Documentation request HOT 1
- How to user Discover network targets mode inspect app
- DevTools inspect window doesn't render properly HOT 52
- Windows cannot be displayed after chrome update HOT 10
- github says version 1.6.0 is released but I couldn't find it HOT 3
- How fix this? HOT 5
- Chrome debugging not showing network api responce
- Stetho doesn't capture network in network inspector HOT 2
- Feature request to view datastore data
- NoSuchMethodError issue
- Usage of weak crypto algorithms like SHA-1 in Stetho HOT 1
- Inspect Devices UI is distorted HOT 3
- Question: How does Stetho Draw OkHttp Requests in Network Tab? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stetho.