How to increase Android "waitDuration" app startup timeout

For some reason I’m unable to locate details on how to increase the timeout during my Android app startup.

My issue:

  • Appium successfully launches my AUT on my device.
  • The AUT splash screen successfully appears.
  • Due to network / API / whatever issues the AUT isn’t getting server responses particularly fast and the splash screen remains for 30-60 seconds (normally it’s just a few seconds and there’s no problem).
  • Finally the AUT initial app screen (Wait For Activity) is rendered.

Unfortunately, Appium is erroring creating the new session after about 20 seconds of splash screen.

WebDriverException: Message: A new session could not be created. (Original error: <my_AUT>.activities.<my_target_activity> never started. Current: <my_AUT>.activities.<launch_activity>)

Device Ready Timeout doesn’t appear to be the proper setting to control this behavior. What is the proper setting to extend the timeout in this scenario?

Looks like waitDuration was added via this: https://github.com/appium/appium-adb/pull/46 Now to figure out how to set it.

Add this capability to desired capabilities you pass while creating driver -

“newCommandTimeout” : 50000

Hope this works.

“newCommandTimeout” does not appear to be the appropriate flag to set for this specific feature.

There appears to be a specific “waitDuration” flag, but I can’t seem to set it at runtime and isn’t mentioned in the Appium server flags documentation as best I can tell.

See the following Appium source code snippet:

if (startAppOptions.hasOwnProperty("waitDuration")) {
+          this.waitForActivity(startAppOptions.waitPkg, startAppOptions.waitActivity, startAppOptions.waitDuration, cb);
+        } else {
+          this.waitForActivity(startAppOptions.waitPkg, startAppOptions.waitActivity, cb);
+        }
       } else {

I have the same problem - did you figure out how set this “waitDuration” at runtime?

Sorry for the late response. I never did figure this out, thankfully it’s a rare occurrence for me.