im facing similar issue when i running appium programatically through my java code, its working fine on both platform windows and IOS but not with ubunto however, all variable are set properly and u can run adb command from terminal , appium doctor shows everything is okay as well
but im still getting this error "org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Could not find ‘adb’ in PATH. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’
System info: host: ‘warrior’, ip: ‘192.168.1.8’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.18.0-25-generic’, java.version: ‘1.8.0_212’
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find ‘adb’ in PATH. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.
at getResponseForW3CError (/home/linuxbrew/.linuxbrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
at asyncHandler (/home/linuxbrew/.linuxbrew/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:447:37)
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’
System info: host: ‘warrior’, ip: ‘192.168.1.8’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.18.0-25-generic’, java.version: ‘1.8.0_212’
Driver info: driver.version: AndroidDriver
"
this my bash file
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin
export PATH=$PATH:$JAVA_HOME/jre/bin
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PLATFORM_TOOLS="/home/amrka/Android/Sdk/platform-tools"
export NODE_HOME="/usr/local/bin/node"
this is sample from my script
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/bin/node"))
.withAppiumJS(new File("/home/linuxbrew/.linuxbrew/lib/node_modules/appium/build/lib/main.js"))
.withArgument(Arg.ADDRESS,URL_)
.withArgument(Arg.PORT,Sport)
.withArgument(Arg.CALLBACKPORT,Sport)
.withArgument(Arg.WDALOCALPORT,wdaPort)
.withArgument(Arg.BootstrapPort,bootStrap)
// .withArgument(Arg.NODECONFIG,path) //uncomment this when use parallel test with grid
.withArgument(Arg.SESSIONOVERRIDE));
service.start();