Getting Bad parameters error trying to run tests on Android 7.0

Hey everyone!
I have problem with running tests on Android 7.0 real device (Nexus 6)
Appium version: 1.6.3
OS: Windows 10
Language: Java

What’s interesting, when I plug in any Android 6 device (setting platformVersion to 6.0) - the tests are running without a problem. But when I try to run them on Android 7.0 device I get the error.

Here are my capabilities for running on Android 7.0:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“deviceName”, “Android”);
capabilities.setCapability(“browserName”, “Android”);
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“platformVersion”, “7.0”);
capabilities.setCapability(“fullReset”, true);
capabilities.setCapability(“autoAcceptAlerts”, true);
capabilities.setCapability(“newCommandTimeout”, 0);
capabilities.setCapability(“app”, “C:\Apk\xxx-release.apk”);
capabilities.setCapability(“appPackage”, “com.xxx.android.vvm”);
capabilities.setCapability(“appActivity”, “com.xxx.android.vvm.activity.Splash”);

Here are the logs from IDE console output:

Feb 14, 2017 4:21:19 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel’s Law holds true on the remote end
Feb 14, 2017 4:21:24 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Feb 14, 2017 4:21:29 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection

org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=C:\Apk\xxx-release.apk, appPackage=com.xxx.android.vvm, appActivity=com.xxx.android.vvm.activity.Splash, newCommandTimeout=0, platformVersion=7.0, browserName=Android, platformName=Android, deviceName=Android, fullReset=true, autoAcceptAlerts=true}], required capabilities = Capabilities [{}]
Build info: version: ‘3.0.1’, revision: ‘1969d75’, time: ‘2016-10-18 09:48:19 -0700’
System info: host: ‘TAC-45’, ip: ‘10.3.184.68’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_111’
Driver info: driver.version: AndroidDriver

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:141)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:92)
at settings.AndroidSettings.setUp(AndroidSettings.java:47)
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:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:144)
at org.testng.TestRunner.beforeRun(TestRunner.java:634)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
at org.testng.TestNG.runSuites(TestNG.java:1133)
at org.testng.TestNG.run(TestNG.java:1104)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127)
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:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

And here are the server logs:

[debug] [AndroidDriver] Not cleaning generated files. Add clearSystemFiles capability if wanted.
[MJSONWP] Encountered internal error running command: Error: Error executing adbExec. Original error: ‘Command ‘C:\Android\sdk\platform-tools\adb.exe -P 5037 -s ZX1G22D7HJ install C:\Users\user\AppData\Roaming\npm\node_modules\appium\node_modules\io.appium.settings\bin\settings_apk-debug.apk’ exited with code 1’; Stderr: ‘Failed to install C:\Users\user\AppData\Roaming\npm\node_modules\appium\node_modules\io.appium.settings\bin\settings_apk-debug.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package io.appium.settings signatures do not match the previously installed version; ignoring!]’; Code: ‘1’
at ADB.execFunc$ (…/…/…/lib/tools/system-calls.js:195:13)
at tryCatch (C:\Users\user\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\user\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\user\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\user\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[HTTP] ← POST /wd/hub/session 500 4879 ms - 754
[HTTP] → POST /wd/hub/session {“capabilities”:{“desiredCapabilities”:{“app”:“C:\Apk\xxx-release.apk”,“appPackage”:“com.xxx.android.vvm”,“appActivity”:“com.xxx.android.vvm.activity.Splash”,“newCommandTimeout”:0,“platformVersion”:“7.0”,“browserName”:“Android”,“platformName”:“Android”,“deviceName”:“Android”,“fullReset”:true,“autoAcceptAlerts”:true},“requiredCapabilities”:{}}}
[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {“required”:[“desiredCapabilities”],“optional”:[“requiredCapabilities”,“capabilities”,“sessionId”,“id”,“sessionId”,“id”,“sessionId”,“id”]} and you sent [“capabilities”]

The last error is what concerns me the most:

Bad parameters: BadParametersError: Parameters were incorrect. We wanted {“required”:[“desiredCapabilities”],“optional”:[“requiredCapabilities”,“capabilities”,“sessionId”,“id”,“sessionId”,“id”,“sessionId”,“id”]} and you sent [“capabilities”]

Is there another way to set the capabilities?

Thanks!

Hi @aatayants Have this issue been fixed? can you pls share me the solution for this issue?

Use appium 1.6.4-beta 6 and java client latest beta, I am running my tests with android 7.1.1,works great!

Hey @khiemkao

I’ve just deleted Appium Settings and Unlock apps from the phone and run tests again so that they were reinstalled. That worked for me.

Hi @aatayants @Abush
thanks for ur reply. i found out that my problem is missing android-driver (or out of date), cause my problem happens with android only (try running ios-platform on saucelabs, it works fine)
so after running command npm install appium-android-driver it’s ok now

@aatayants Thank you so much for this solution, I was looking for the solution of this issue since last 1 week.

can someone help with listing jar files which are to be included?