Ash Barty is the Miami Open champion for a second-straight year after Bianca Andreescu retired with injury.