I'm new to coding and also Ionic, but here is a solution to an issue that I faced, with an explanation for my situation.
I tried to ionic build android
but it gave out an error message that ended with Command failed with exit code 1
The fix would be to ionic platform remove android
and then add it back again with ionic platform add android
.
Where it went wrong, I think, is that I updated my android's xml manifest, to update the name for the app. So if you did the same, this will definitely solve it for you.
Maybe someone out there can explain further, and point out a workaround that doesn't require removing the platform.