Error when creating new AndroidDriver object: java.lang.NoSuchFieldError: INSTANCE org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>

I’m using testNG on android studio. I have created an XML file to run my test suite. When i run test suite from XML file (by right click and run XML file), it works fine.

But as i have 4 different XML files, each running different test suites,
I had to create another class, through which i tried to call the XML file which is to be executed. Here, it is showing the following error:
java.lang.NoSuchFieldError: INSTANCE
org.apache.http.conn.ssl.SSLConnectionSocketFactory.(SSLConnectionSocketFactory.java:144)
org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:71)
org.openqa.selenium.remote.internal.HttpClientFactory.(HttpClientFactory.java:57)
org.openqa.selenium.remote.internal.HttpClientFactory.(HttpClientFactory.java:60)
org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(ApacheHttpClient.java:251)
org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.(ApacheHttpClient.java:228)
org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:96)
org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:70)
org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:58)
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:156)
io.appium.java_client.AppiumDriver.(AppiumDriver.java:109)
io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:39)
samsung.appiumtest.spay.Utils.DriverManager.AppiumSetUp(DriverManager.java:60)
samsung.appiumtest.spay.Utils.DriverManager.setUpDriver(DriverManager.java:32)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
org.testng.SuiteRunner.run(SuiteRunner.java:268)
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
org.testng.TestNG.run(TestNG.java:1064)
samsung.appiumtest.spay.TestCases.UI_4_0.CallTestNG.main(CallTestNG.java:44)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
No logs in appium server are there

I’m getting this error in following line:
driver = new AndroidDriver(new URL(“http://127.0.0.1:4732/wd/hub”), capabilities);

Gradle depencies:
dependencies {
compile fileTree(include: [’*.jar’], dir: ‘libs’)
androidTestCompile ‘com.android.support.test.uiautomator:uiautomator-v18:2.1.2’
androidTestCompile ‘com.android.support.test:testing-support-lib:0.1’

testCompile 'org.testobject:testobject-appium-java-api:0.0.24'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'

testCompile 'org.assertj:assertj-core:2.0.0'
testCompile 'org.testng:testng:6.9.10'

compile files('libs/reportng-1.1.4.jar')
compile files('libs/velocity-dep-1.4.jar')

compile 'org.testng:testng:6.9.10'

}

I have added jcenter repository as well.
Gradle version: 3.3
Android studio: 2.3.3
Appium version: 1.6.5
Using real device for automation
Automation using TestNG (6.9.10)
Windows 7 OS

TestNG runner=new TestNG();
List suitefiles=new ArrayList();
suitefiles.add(“app\src\*\testSuite1.xml”);
runner.setTestSuites(suitefiles);
// finally execute the runner using run method
runner.run();

This is how i have called the xml file