Build android fail on mac

I just bought mac and just install android studio and java jdk…
when I type which java
command says
/usr/bin/java
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):

    ANDROID_HOME=/Users/jpd/Library/Android/sdk

    JAVA_HOME=/Library/Java/Home

    

    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 

    Studio.app/Contents/gradle/gradle-3.2/bin/gradle: Command failed with 

    exit code 1