How dose gralde resolve version, latest or highest?

Direct dependencies vs dependency constraints

When Gradle attempts to resolve a dependency to a module version, 
all dependency declarations with version, all transitive dependencies and all dependency constraints for that module are taken into consideration.  

The highest version that matches all conditions is selected. 

the latest means publish to maven repo time. such as, sometime, 1.10 is published later than 2.2.

and what situation use latest, what situation use highest?

The time a module is published is not considered. Version selection and conflict resolution is based on version number comparison, detailed in Version Ordering.