Unable to build apk please help me

I am trying to build apk but I’m unable to create it, Getting the following errors. But project running successfully.

When I an running the following command:

ionic cordova build android


please help me out.

Update cordova and the android platforms.

npm install -g cordova

ionic cordova platform rm android

ionic cordova platform add android

Thank you so much, now able to build apk