Appium 1.6.5 installation - Could not find JAVA, skipping UiAutomator2 install

ENV:
macOS Sierra 10.12.6
Appium 1.6.5 / 1.6.6 - beta4


When we installed the appium successfully however it seems that the UiAutomator2 isn’t installed (see below log)

Why doesn’t it find the Java & how it can be fixed?


[email protected] install /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-driver

node ./bin/install.js

dbug AndroidDriver Getting Java version
Could not find JAVA, skipping UiAutomator2 install

When I run java -version I discover that the path was to the old java instead (1.6) instead of the 1.8.

Steps to fix it:
Update the bash file with the updated data:

  • vim .bash_profile (Opened the bash from terminal)
  • i for edit
  • Added the following data:
    export ANDROID_HOME=/Users/menypeled/Library/Android/sdk
    export ANDROID_SDK=$ANDROID_HOME
    PATH=$PATH:/Applications/apache-ant-1.8.4/bin
    PATH=$PATH:/usr/local/share/npm/bin/
    PATH=$PATH:$ANDROID_HOME/build-tools
    PATH=$PATH:$ANDROID_HOME/platform-tools
    PATH=$PATH:$ANDROID_HOME/tools

export PATH=${JAVA_HOME}/bin:$PATH
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$PATH:$JAVA_HOME/bin

  • esc for exit edit mode
  • :wq! for exit & save

Now when running java -version showed the updated java version & when I ran the Appium installation again it finded the java & installed the uiautomator successfully