admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

Can't run tests on some apks unless io.appium.settings is restarted #578

Closed MilanJimi closed 5 years ago

MilanJimi commented 5 years ago

So I have this problem where I can not start my app, unless I kill io.appium.settings in adb. How it woks is: The app will launch and close several times, but no tests will run. Then I get this message:

ERROR: An unknown server-side error occurred while processing the command. Original error: Cannot 
start the 'my.app.package' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-
running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. 
Original error: 'Command '/home/me/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am 
start -W -n my.app.package/host.exp.exponent.MainActivity -S -a android.intent.action.MAIN -c 
android.intent.category.LAUNCHER -f 0x10200000' exited with code null'; Stderr: ''; Code: 'null'

I can work around this by adb shell ps | grep appium and then

adb shell
su
kill {PID}

after which the test will start properly, but that is super annoying to do every time. Another option is by adb shell am force-stop io.appium.settings, but this one works only every second time (after a failed startup. Will not work if the test ran propely). Also, appium will NOT run any following tests.

Server logs are both the same for running and not running case, until last shared command

[debug] [ADB] Running '/home/me/Android/Sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 
am start -W -n my.app.bundle/host.exp.exponent.MainActivity -S -a android.intent.action.MAIN -c 
android.intent.category.LAUNCHER -f 0x10200000'

after which working case will continue as normal while bug case will cease activitiy and will rerun this command three times before exiting.

This has not been an issue with other APKs I have tried. Is there some type of Apks that Appium can't properly read? The one I mention here was created via Expo.io.

MilanJimi commented 5 years ago

Problem persists even if I run wdio via adb shell am force-stop io.appium.settings && ./node_modules/.bin/wdio ./path/to/spec.js. In this case, appium will once work and then once not and than work again - every other time. I believe this has something to do with different starting states of io.appium.settings

jlipps commented 5 years ago

This is not a wd bug, please report at the Appium repo.