Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run appium tests on Android 7.0

Tags:

android

appium

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

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)

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
at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
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/nexttick.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"]

It appears that there is an error with capabilities. However when I plug in a phone with Android 6 and set platformVersion to 6.0 all tests are running without a problem!

I would appreciate any help.

like image 757
APC551 Avatar asked Feb 16 '17 20:02

APC551


1 Answers

Remove "Unlock" and "Appium settings" apps from device - Appium installs those apps automatically. (In my cause those apps were not compatible after updating Android from version 6 to version 7.

like image 121
Lukas Lewandowski Avatar answered Oct 21 '22 07:10

Lukas Lewandowski