This book also has the main character fall in love with a robot who the main villain had created to put his mind into the robot's body.
The main girl is in a space fleet fighting for her home planet against Earth's robotic armies, who flew through stargates. She and her squadron get shot down. Only her and another person survive, but the other is in critical condition.
They land on an old Earth ship and discover that there is a working android on there, but it is different than the others. They eventually go through a bunch of different places to get the android back to Earth to destroy the Earth's stargate system.
When they get there they find out that the main villain made the android, that the main girl had fallen in love with by then, to hold the villain's mind as he was growing old and going to die soon. They destroy the Earth stargate system and all go back to the main planet.