Getting java.lang.UnsatisfiedLinkError while running gradle test task

I am getting the java.lang.UnsatisfiedLinkError error whenever I am running the gradle test task. This is happening when I run Selenium tests with version 2.46 and above while running them on FF version 43 and above.

If I run the tests on FF 42.0 using Selenium 2.45 dependency then the tests run fine. The error is not displayed.

The following stacktrace is displayed:
java.lang.UnsatisfiedLinkError: Can’t obtain updateLastError method for class com.sun.jna.Native
at com.sun.jna.Native.initIDs(Native Method)
at com.sun.jna.Native.(Native.java:139)
at org.openqa.selenium.os.Kernel32.(Kernel32.java:34)
at org.openqa.selenium.os.ProcessUtils.killWinProcess(ProcessUtils.java:133)
at org.openqa.selenium.os.ProcessUtils.killProcess(ProcessUtils.java:81)
at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.destroyHarder(UnixProcess.java:247)
at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$200(UnixProcess.java:201)
at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:125)
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:155)
at org.openqa.selenium.firefox.FirefoxBinary.quit(FirefoxBinary.java:259)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.quit(NewProfileExtensionConnection.java:204)
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.quit(FirefoxDriver.java:364)
at org.openqa.selenium.firefox.FirefoxDriver.stopClient(FirefoxDriver.java:310)
at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:529)
at org.openqa.selenium.WebDriver$quit$2.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at com.demo.POM.singleton.driver.WebDriverFactory.closeDriver(WebDriverFactory.groovy:44)
at com.demo.POM.singleton.driver.WebDriverFactory$closeDriver$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at com.demo.POM.singleton.BaseTest.afterClass(BaseTest.groovy:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:225)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:114)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

My build.gradle file is as below:
`
apply plugin: 'groovy’
apply plugin: ‘eclipse’

repositories {
mavenCentral()
}

dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.5’
compile 'org.seleniumhq.selenium:selenium-java:2.50.0’
compile 'io.appium:java-client:2.2.0’
compile ‘com.google.inject:guice:3.0’
// testCompile dependency to testCompile ‘org.testng:testng:6.8.1’ and add
// ‘test.useTestNG()’ to your build script.
compile ‘org.testng:testng:6.8.1’
//compile ‘com.applitools:eyes-selenium-java:2.22’
}

/sourceSets.main.java.srcDirs = []
sourceSets.main.groovy.srcDirs += [‘src/main/java’]
/

tasks.withType(Test) {
useTestNG() {
// comment the below code to stop parallelization of tests.
parallel = 'tests’
threadCount = 5
}
systemProperties = System.getProperties()

maxParallelForks = 2

options {
    listeners << "com.demo.POM.singleton.Listeners.TestFailureListener"
}

}
`

The error goes away if I add each of the system properties to be passed to the jvm explicitly like so:
systemProperties = [ BROWSER : System.getProperty('BROWSER', 'firefox'), SELENIUM_HOST : System.getProperty('SELENIUM_HOST', 'localhost'), SELENIUM_PORT : System.getProperty('SELENIUM_PORT', '4444'), DRIVERTYPE : System.getProperty('DRIVERTYPE', 'local'), SAUCE_USERNAME : System.getProperty('SAUCE_USERNAME', ''), SAUCE_ACCESS_KEY : System.getProperty('SAUCE_ACCESS_KEY', ''), SELENIUM_PLATFORM: System.getProperty('SELENIUM_PLATFORM', 'Windows 8'), SELENIUM_VERSION : System.getProperty('SELENIUM_VERSION', '42') ]
But, I don’t want to have to specify each of the new system properties explicitly in the build file along with my framework config file.

I have also tried the other steps that require me to set jna.boot.library.path to null or some such thing. However to no avail.

Am aware there was a previous issue which was marked as fixed in Release 2.4 rc2 (bug GRADLE-3288). But am still facing this issue with gradle version 2.10.

Could someone look in to this please?