Error message during ionic build

whenever I run

ionic build android
The following error occurs

Its not getting Java path, it happens with me also sometimes try to build it again it will work fine.