How to start specific Appium Version with AppiumServiceBuilder

Good morning all,

Locally I’m running Appium Version 1.20.1 because 1.18 has a bug when it comes to detected an AVD emulator being launched. I’m looking to launch Appium programatically and have it working however it is opening 1.18. Is there any way to specify which version to launch?

This is my excerpt from BaseTest which all tests inherit from.

public void launchAppiumServer(){
    AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();

    server = AppiumDriverLocalService.buildService(serviceBuilder);

All help appreciated.

Thx in advance.


  1. you should install appium versions into different locations
  2. to start service with needed version just add:
serviceBuilder.withAppiumJS(new File("/path/to/appium"));

Many thanks Aleksei,

I had been tinkering around with that but couldn’t get it to behave. You sent me on the right track and with some digging I updated by Appium version via npm to 1.20.2 (Which was the version I needed).

Have ended up with good solid working result:
public void startAppiumServer(){
AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder()
.withArgument(GeneralServerFlag.ALLOW_INSECURE, “adb_shell”);
appiumServer = AppiumDriverLocalService.buildService(serviceBuilder);

Adding code in case it helps others in the futre.
Thx again!