Reputation: 617
I get some problems with okhttp3 lib.
I added the following line in my gradle file dependency:
compile 'com.squareup.okhttp3:okhttp:3.4.1'
After that, I try to create webSocket connection like okhttp websocket example, but in Android Studio I don't see any classes and interfaces like
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
But I know that these files exist in okhttp3. Can anybody explain what I did wrong?
If we see in okhttp javadoc we can not find these classes. But they are in github.
Upvotes: 2
Views: 2730
Reputation: 1
Oct2019:
I have tried below line/version and works for me:
implementation("com.squareup.okhttp3:okhttp:4.2.1")
reference: https://github.com/square/okhttp
Upvotes: -1
Reputation: 76115
You have to add the okhttp-ws
module.
compile 'com.squareup.okhttp3:okhttp-ws:3.4.1'
WebSockets are moving out of a separate, experimental artifact and into the core okhttp
artifact for the next release, 3.5.0, which is what you see if you look at GitHub.
Upvotes: 8