[ADB] The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
See original GitHub issueThe problem
unable to start appium programmatically as its not able to find adb path as shown in log below, however all path variable are set and able to call it from terminal also appium-doctor doesn’t show any issue
this is my bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH="$JAVA_HOME/bin:$PATH"
export ANDROID_HOME="/users/amrka/library/Android/sdk"
export MVN_HOME="/usr/local/Cellar/maven/3.6.3"
export PATH="$MVN_HOME/bin:$PATH"
export PATH="$ANDROID_HOME/platform-tools:$PATH"
export PATH="$ANDROID_HOME/tools:$PATH"
export PATH="$ANDROID_HOME/tools/bin:$PATH"
export PATH="$ANDROID_HOME/build-tools/29.0.3:$PATH"
export PATH="/usr/local/bin/carthage:$PATH"
export APPIUM_HOME="/usr/local/lib/node_modules/appium/build/lib/main.js"
export NODE_HOME="/user/local/bin/node"
export PATH="$JAVA_HOME/jre/bin:$PATH"
export PATH="$PATH:/opt/yarn-1.19.1/bin"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
export O_SYS="MacOS"
Environment
- Appium version (or git revision) that exhibits the issue: 1.17.0
- Last Appium version that did not exhibit the issue (if applicable):
- Desktop OS/version used to run Appium: MacOS
- Node.js version (unless using Appium.app|exe): 12
- Npm or Yarn package manager: 6
- Mobile platform/version under test: Android
- Real device or emulator/simulator: Emulator
- Appium CLI or Appium.app|exe: CLI
Details
i can call adb from terminal with no problem all, env variables are set as shown above in the bash_file yet , appium is still unable to execute the test as it seems adb not accessible for appium CLI
Link to Appium logs
==> Driver Is Initiated <==
[Appium] Welcome to Appium v1.17.1
[Appium] Non-default server args:
[Appium] port: 13192
[Appium] allowInsecure: {
[Appium] 0: chromedriver_autodownload
[Appium] }
[Appium] Appium REST http interface listener started on 0.0.0.0:13192
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[debug] [GENERIC] Calling AppiumDriver.getStatus() with args: []
[debug] [GENERIC] Responding to client with driver.getStatus() result: {"build":{"version":"1.17.1"}}
[HTTP] <-- GET /wd/hub/status 200 10 ms - 68
[HTTP]
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"androidDeviceReadyTimeout":120,"app":"/Users/amrka/Desktop/Desktop/trackerproducts/MobileAutomationTest/src/main/resources/SAFE.apk","appPackage":"com.trackerproducts.mobile","isHeadless":true,"disableWindowAnimation":true,"clearSystemFiles":true,"ensureWebviewsHavePages":true,"uiautomator2ServerInstallTimeout":120000,"deviceName":"emulator-5554","deviceReadyTimeout":120,"avd":"pixel","appActivity":"com.trackerproducts.mobile.MainActivity","appWaitForLaunch":true,"avdLaunchTimeout":120000,"chromedriverExecutable":"src/main/resources/chromedriver","nativeWebScreenshot":true,"platformVersion":"10","automationName":"uiautomator2","autoGrantPermissions":true,"platformName":"android","avdReadyTimeout":120000},"capabilities":{"firstMatch":[{"appium:androidDeviceReadyTimeout":120,"appium:app":"/Users/amrka/Desktop/Desktop/trackerproducts/MobileAutomationTest/src/main/resources/SAFE.apk","appium:appActivity":"com.trackerproducts.mobile.MainActivity","appium:appPackage"
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"androidDeviceReadyTimeout":120,"app":"/Users/amrka/Desktop/Desktop/trackerproducts/MobileAutomationTest/src/main/resources/SAFE.apk","appPackage":"com.trackerproducts.mobile","isHeadless":true,"disableWindowAnimation":true,"clearSystemFiles":true,"ensureWebviewsHavePages":true,"uiautomator2ServerInstallTimeout":120000,"deviceName":"emulator-5554","deviceReadyTimeout":120,"avd":"pixel","appActivity":"com.trackerproducts.mobile.MainActivity","appWaitForLaunch":true,"avdLaunchTimeout":120000,"chromedriverExecutable":"src/main/resources/chromedriver","nativeWebScreenshot":true,"platformVersion":"10","automationName":"uiautomator2","autoGrantPermissions":true,"platformName":"android","avdReadyTimeout":120000},null,{"firstMatch":[{"appium:androidDeviceReadyTimeout":120,"appium:app":"/Users/amrka/Desktop/Desktop/trackerproducts/MobileAutomationTest/src/main/resources/SAFE.apk","appium:appActivity":"com.trackerproducts.mobile.MainActivity","appium:appPackage":"com.trackerproducts.mobile","appWaitForLaunch":true...
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1588933173152 (12:19:33 GMT+0200 (Central European Summer Time))
[BaseDriver] The following capabilities are not standard capabilities and should have an extension prefix:
[BaseDriver] appWaitForLaunch
[BaseDriver] ensureWebviewsHavePages
[BaseDriver] uiautomator2ServerInstallTimeout
[Appium] Appium v1.17.1 creating new AndroidUiautomator2Driver (v1.44.2) session
[Appium] Explicitly enabling use of insecure features:
[Appium] chromedriver_autodownload
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] "alwaysMatch": {
[debug] [BaseDriver] "appium:appWaitForLaunch": true,
[debug] [BaseDriver] "appium:ensureWebviewsHavePages": true,
[debug] [BaseDriver] "platformName": "android",
[debug] [BaseDriver] "appium:uiautomator2ServerInstallTimeout": 120000,
[debug] [BaseDriver] "appium:androidDeviceReadyTimeout": 120,
[debug] [BaseDriver] "appium:app": "/Users/amrka/Desktop/Desktop/trackerproducts/MobileAutomationTest/src/main/resources/SAFE.apk",
[debug] [BaseDriver] "appium:appActivity": "com.trackerproducts.mobile.MainActivity",
[debug] [BaseDriver] "appium:appPackage": "com.trackerproducts.mobile",
[debug] [BaseDriver] "appium:autoGrantPermissions": true,
[debug] [BaseDriver] "appium:automationName": "uiautomator2",
[debug] [BaseDriver] "appium:avd": "pixel",
[debug] [BaseDriver] "appium:avdLaunchTimeout": 120000,
[debug] [BaseDriver] "appium:avdReadyTimeout": 120000,
[debug] [BaseDriver] "appium:chromedriverExecutable": "src/main/resources/chromedriver",
[debug] [BaseDriver] "appium:clearSystemFiles": true,
[debug] [BaseDriver] "appium:deviceName": "emulator-5554",
[debug] [BaseDriver] "appium:deviceReadyTimeout": 120,
[debug] [BaseDriver] "appium:disableWindowAnimation": true,
[debug] [BaseDriver] "appium:isHeadless": true,
[debug] [BaseDriver] "appium:nativeWebScreenshot": true,
[debug] [BaseDriver] "appium:platformVersion": "10"
[debug] [BaseDriver] },
[debug] [BaseDriver] "firstMatch": [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] Session created with session id: fa0871c5-233e-4636-9d00-fe8f4be49cac
[BaseDriver] Using local app '/Users/amrka/Desktop/Desktop/trackerproducts/MobileAutomationTest/src/main/resources/SAFE.apk'
[debug] [UiAutomator2] Checking whether app is actually present
[ADB] The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+. Checking along PATH for adb.
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1588933173935 (12:19:33 GMT+0200 (Central European Summer Time))
[debug] [W3C] Encountered internal error running command: Error: Could not find 'adb' in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT environment variables to the correct Android SDK root directory path.
[debug] [W3C] at ADB.getBinaryFromPath (/usr/local/lib/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:140:11)
[debug] [W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 953 ms - 791
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Could not find adb Please set the ANDROID_HOME ...
You need to add the path to the android-sdk to ANDROID_HOME environment variable. e.g. C:\installation-location\android-sdk or ...
Read more >Could not find adb Please set the ANDROID_HOME ...
[ADB] The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK 23+....
Read more >Start the emulator from the command line - Android Developers
You can set the environment variable in the terminal window before launching a virtual device or through your user settings in the operating ......
Read more >URGENT HELP NEEDED | Appium Forum - QTPselenium
The ANDROID_HOME environment variable is not set to the Android SDK root directory path. ANDROID_HOME is required for compatibility with SDK ...
Read more >Help, adb is not found!. So you've downloaded Android Studio ...
But this isn't necessary! adb ships with the Android SDK installed by ... Towards the top of the window, you can see the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since Catalina Apple has changed the default shell to zsh. Consider changing .zshrc instead to avoid manual interaction after each reboot
srry for last response, unfortunately i didn’t get anything useful from process env
its working now by using this variables, though every time i restart the mac machine have to run source ~/.bash_profile before starting the editor
export JAVA_HOME=$(/usr/libexec/java_home) export PATH="$JAVA_HOME/bin:$PATH" export ANDROID_HOME="/users/amrka/library/Android/sdk" export MVN_HOME="/usr/local/Cellar/maven/3.6.3" export PATH="$MVN_HOME/bin:$PATH" export PATH="$ANDROID_HOME/platform-tools:$PATH" export PATH="$ANDROID_HOME/tools:$PATH" export PATH="$ANDROID_HOME/tools/bin:$PATH" export PATH="$ANDROID_HOME/build-tools/29.0.3:$PATH" export PATH="/usr/local/bin/carthage:$PATH" export APPIUM_HOME="/usr/local/lib/node_modules/appium/build/lib/main.js" export NODE_HOME="/usr/local/bin/node" export PATH="$JAVA_HOME/jre/bin:$PATH" export PATH="$PATH:/opt/yarn-1.19.1/bin" export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" export O_SYS="mac"