Ionic build command was working fine until I decided to add some custom splash screen and run the following command,
ionic resources
In my case it was the too long directory path. After I copied everything directly to d:\myapp, the "ionic cordova build android" command works as expected.
I found the solution in the ionic forum:
Ionic Forum - Build Failed on existing project