Build android fail on mac

I just bought mac and just install android studio and java jdk…
when I type which java
command says
and typed java -version and checked java is installed

to configure JAVA HOME, I just exactly follows below link

then, I command ionic cordova build android,
it has error like below.

cordova build android

:heavy_multiplication_x: Running command - failed!

[ERROR] An error occurred while running cordova build android (exit code 1):




    ERROR: JAVA_HOME is set to an invalid directory: /Library/Java/Home


    Please set the JAVA_HOME variable in your environment to match the

    location of your Java installation.


    Error: /Applications/Android Command failed with 

    exit code 1