question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not find MockWebServer class

See original GitHub issue

I use testCompile add MockWebServer library ,but can not find MockWebServer class. My AndroidStudio version is 1.5.1.

  compile 'com.squareup.okhttp3:okhttp:3.0.1'
  testCompile 'com.squareup.okhttp:mockwebserver:2.7.2'

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

19reactions
yjwfncommented, Jan 18, 2016

I solved this problem by using androidTestCompile .

compile 'com.squareup.okhttp3:okhttp:3.0.1'
androidTestCompile 'com.squareup.okhttp:mockwebserver:2.7.2'
1reaction
farruhhacommented, Nov 9, 2019

it’s not available on testImplementation("com.squareup.okhttp3:mockwebserver:4.0.0"), i still got same error

I think latest stable version is androidTestImplementation "com.squareup.okhttp3:mockwebserver:3.10.0"

Read more comments on GitHub >

github_iconTop Results From Across the Web

android studio - Unresolved Reference: mockwebserver
I found the culprit. When adding the dependency to the build.gradle file it should read implementation ...
Read more >
How to Use MockWebServer to Mock and Test HTTP Calls
The first option is to run the Main class. However, this will require making a real HTTP request to an external API. That...
Read more >
Change Log - OkHttp
The new APIs use mockwebserver3 in both the Maven coordinate and package name. This new API is not stable and will likely change...
Read more >
The Recommended Way Of Testing HTTP Calls ... - Medium
A mock web server is a program that mocks the behavior of an actual remote server but doesn't make calls over the internet....
Read more >
Testing Spring Boot WebClient With MockWebServer
Since it's communicating over an HTTP connection, it's not a unit test. Using MockWebServer is quite straightforward: public class ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found