I'm trying to run a simple appium test case , but when executing the test this exception is throwed Exception in thread "main" java.lang.NoClassDefFoundError: okhttp3/ConnectionPool
for this line of code
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://localhost:4723/wd/hub"), caps);
the code I used is
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "blustack");
caps.setCapability("udid", "emulator-5554"); //Give Device ID of your mobile phone
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "7.1.2");
caps.setCapability("appPackage", "com.sourcey.materialloginexample");
caps.setCapability("appActivity", "com.sourcey.materialloginexample/com.sourcey.materiallogindemo.LoginActivity");
caps.setCapability("noReset", "true");
//Instantiate Appium Driver
try {
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://localhost:4723/wd/hub"), caps);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
I found a same issue here but the proposed solution doesn't work.