这是我传递的参数
String[] fromPoint:["40.7127837,-74.0059413","33.9533487,-117.3961564"];
String[] toPoint:["38.6270025,-90.19940419999999","12.8445,80.1523"];
// this is code i was written, i was convert string to latlng and when i try to execute code i will get
-11-16 16:31:52.130信息10956--[nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult:重试请求。重试#1 2018-11-16 16:31:52.568信息10956--[nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult:重试请求。重试#2 2018-11-16 16:31:53.594信息10956--[nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult:重试请求。重试#3 2018-11-16 16:31:54.907信息10956--[nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult:重试请求。重试#4 2018-11-16 16:31:55.914信息10956--[nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult:重试请求。重试#5 2018-11-16 16:31:57.544信息10956 --- [nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult:重试请求。重试#6
String key = "Key";
LatLng[] fLatLong = getLatLong(fromPoint);
LatLng[] tLatLong = getLatLong(toPoint);
try{
GeoApiContext distCalcer = new GeoApiContext.Builder()
.apiKey(key)
.build();
DistanceMatrixApiRequest req = DistanceMatrixApi.newRequest(distCalcer);
DistanceMatrix result = req.origins(fLatLong)
.destinations(tLatLong)
.await();
DistanceMatrixElement[] row = result.rows[0].elements;
System.out.println(row[0].toString());
}catch(Exception e){
e.getStackTrace();
}
请帮助谢谢!