Appium Android driver.startActivity() is adding -W to the adb command even if appWaitForLaunch is set to false
See original GitHub issueThe problem
After setting appWaitForLaunch
to false
, when I try to launch activity by calling driver.startActivity() method, it call gets stuck and eventually times out.
Environment
- Appium version (or git revision) that exhibits the issue: 1.21.0
- Last Appium version that did not exhibit the issue (if applicable): None
- Desktop OS/version used to run Appium: Mac OS Mojave
- Node.js version (unless using Appium.app|exe): 12.18.3
- Npm or Yarn package manager: NPM
- Mobile platform/version under test: Android
- Real device or emulator/simulator: Real Device
- Appium CLI or Appium.app|exe: Both
Details
I am trying to launch a transparent activity that takes some parameters and updates app preferences. This activity stops immediately after it is done with the update. It does not have any UI. When I try to launch the activity, appium call gets stuck and eventually times out. This is because appium android driver adds -W
flag to the target ADB command which waits for the activity to launch. In my case, the activity does not have any UI and so does not launch. I have set the appWaitForLaunch
to false
and noticed that it only works during driver instance creation and app launch as it does not add -W
option. But when tried with driver.startActivity(), it did add the -W
option.
Link to Appium logs
[W3C (146a80b7)] Calling AppiumDriver.startActivity() with args: ["com.myapp.app","com.myapp.instrumentation.persistence.preferences.PreferencesOverrideActivity","com.myapp.app","com.myapp.home.splash.SplashActivity","","","","--es "overrideData" '[{"pref_name": "MyPreferences","overrides": [{"key": "myKey","value": "myValue"","type": "string"}],"clear": false}]' [AndroidDriver] Starting package 'com.myapp.app' and activity 'com.myapp.instrumentation.persistence.preferences.PreferencesOverrideActivity' [ADB] Running '/Users/user1/Library/Android/sdk/platform-tools/adb -P 5037 -s e15adapa shell am start -W -n com.myapp.app/com.myapp.instrumentation.persistence.preferences.PreferencesOverrideActivity -S --es '"overrideData"' "'[{"pref_name": "MyPreferences","overrides": [{"key": "myKey","value": "myValue","type": "string"}],"clear": false}]'"' [Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed. [Instrumentation] INSTRUMENTATION_CODE: 0 [Instrumentation] The process has exited with code 0
Code To Reproduce Issue [ Good To Have ]
Try to launch an activity that does not any UI with androidDriver.startActivity()
method while appWaitForLaunch
is set to false
in capabilities.
Stackoverflow question has the details:
https://stackoverflow.com/questions/68305135/not-able-to-start-activity-using-appium
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top GitHub Comments
Unfortunately no timelines. Contributions are completely voluntary, so it could be done in a day or in a year, - no guarantees there.
Unfortunately the startService extension does not support providing of extra intent arguments as of Appium 1.21 I’ve added this feature to appium@beta though: https://github.com/appium/appium-uiautomator2-driver/pull/468