Unable to run mobile tests on BrowserStack Cloud

When you run mobile tests on an Android or iOS device or emulator on BrowserStack Cloud, the test run fails with the error: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Cause

The file name of the application that is on BrowserStack Cloud and file name of the application that is configured in Test UI do not match. This mismatch might happen if you upload the application file again with a different name.

Resolution

To resolve this issue, you must perform the following steps:
  1. Run the following curl command to list the name of the recently uploaded applications:

    curl -u "username:apikey" -X GET "https://api-cloud.browserstack.com/app-automate/recent_apps

  2. Note down the .apk or .ipa file name of the required application.
  3. Open Test UI, and then switch to the Application Configuration page.
  4. Update the package name of the application with the correct .apk or .ipa file name, and then save on the Edit <Android/iOS> application page.
  5. Select the test suites as required from the Available tests list, and then synchronize the test suite with the application data on the Application Configuration page.
  6. Run the test.