Could not find 'adb' in PATH. Please set the ANDROID_HOME environment variable with the Android SDK root directory path

I’m trying to run appium programmatically within my java codes and I’m getting this error
“Could not find ‘adb’ in PATH. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.”
however, I’m using the same script with windows and IOS and its working properly.
all path variables are set up correctly and tested i dont know why this issue is happening with ubunto.

this is log from appium doctor
info AppiumDoctor Appium Doctor v.1.10.0
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor :heavy_check_mark: The Node.js binary was found at: /home/linuxbrew/.linuxbrew/bin/node
info AppiumDoctor :heavy_check_mark: Node version is 12.5.0
info AppiumDoctor :heavy_check_mark: ANDROID_HOME is set to: /home/amrka/Android/Sdk
info AppiumDoctor :heavy_check_mark: JAVA_HOME is set to: /usr/lib/jvm/java-8-openjdk-amd64
info AppiumDoctor :heavy_check_mark: adb exists at: /home/amrka/Android/Sdk/platform-tools/adb
info AppiumDoctor :heavy_check_mark: android exists at: /home/amrka/Android/Sdk/tools/android
info AppiumDoctor :heavy_check_mark: emulator exists at: /home/amrka/Android/Sdk/tools/emulator
info AppiumDoctor :heavy_check_mark: Bin directory of $JAVA_HOME is set
info AppiumDoctor ### Diagnostic for necessary dependencies completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
info AppiumDoctor :heavy_check_mark: Python required by node-gyp (used by heapdump) is installed at: /usr/bin/python. Installed version is: 2.7.15
WARN AppiumDoctor :heavy_multiplication_x: opencv4nodejs cannot be found.
WARN AppiumDoctor :heavy_multiplication_x: ffmpeg cannot be found
WARN AppiumDoctor :heavy_multiplication_x: mjpeg-consumer cannot be found.
WARN AppiumDoctor :heavy_multiplication_x: bundletool.jar cannot be found
info AppiumDoctor ### Diagnostic for optional dependencies completed, 4 fixes possible. ###
info AppiumDoctor
info AppiumDoctor ### Optional Manual Fixes ###
info AppiumDoctor The configuration can install optionally. Please do the following manually:
WARN AppiumDoctor ➜ Why opencv4nodejs is needed and how to install it: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
WARN AppiumDoctor ➜ ffmpeg is needed to record screen features. Please read https://www.ffmpeg.org/ to install it
WARN AppiumDoctor ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP features. Please install it with npm i -g mjpeg-consumer.
WARN AppiumDoctor ➜ bundletool.jar is used to handle Android App Bundle. Please read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/ to install it
info AppiumDoctor
info AppiumDoctor ###
info AppiumDoctor
info AppiumDoctor Bye! Run appium-doctor again when all manual fixes have been applied!
info AppiumDoctor

this my path variable setup
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
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

export NODE_HOME="/usr/local/bin/node"


note: u can call adb command from any where which mean path is set correctly, also when im using appium desktop its working properly

this part of my script
indent preformatted text by 4 spaces
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)

this appium log

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

@Aleksei
any idea what could be the problem

Any update on this issue. Even im also getting same issue.