Excluding planetary engineering, by the time the two galaxies collide the surface of the Earth will have already become far too hot for liquid water to exist, ending all terrestrial life; that is currently estimated to occur in about 3.75 billion years due to gradually increasing luminosity of the Sun (it will have risen by 35 -- 40 % above the current luminosity).
when is andromeda going to collide with the milky way
about 3.75 billion years