follow me icons

Sunday, February 24, 2019

MAC - could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK Root directory path


An unknown server-side error occurred while processing the command. Original error: Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path. (Selenium::WebDriver::Error::UnknownError)
  UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path.
      at getResponseForW3CError (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
      at asyncHandler (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-base-driver/lib/protocol/protocol.js:447:37)
      at process._tickCallback (internal/process/next_tick.js:68:7)
  ./features/support/hooks.rb:2:in `Before'


To fix the issue:

export ANDROID_HOME="/Users/Users_name/Library/Android/sdk/"



Appium - stack level too deep (SystemStackError)


stack level too deep (SystemStackError)
      ./features/step_definitions/Appium/appiumtest.rb:6:in 
      appium/features/regression/appiumtest.feature:5:in 


The error is caused because the system tries to find the element, but the it is not connected with the emulator and the appium server.

To solve that add a hooks.rb file under the support directory to start and end the driver when the test runs:

hooks.rb:

Before do
  $driver.start_driver 
end

After do
  $driver.driver_quit 
end