0
我想获取客户从Google Places API输入的地点名称的经纬度。外行在第二行冻结。Google Maps Services Java客户端冻结WebApp
try {
GeoApiContext context = new GeoApiContext.Builder().apiKey("MY_API_KEY").build();
PlaceDetails placeDetails = PlacesApi.placeDetails(context, "Nairobi").await();
double lat = placeDetails.geometry.location.lat;
double lng = placeDetails.geometry.location.lng;
} catch (ApiException | InterruptedException | IOException apiException) {
apiException.printStackTrace(System.out);
}
我碰到下面的堆栈跟踪,但我不能完全引脚排列的根本原因,因为我运行的例子是在提供测试的简单。包括在我的应用程序
图书馆是:
- 谷歌,地图服务-0.2.1.jar
- GSON-2.8.1.jar
- okhttp-3.8.1.jar
- 奥基奥-1.13.0.jar
- SLF4J-API-1.7.25.jar
这是堆栈跟踪我门和
Info: apartments was successfully deployed in 2,737 milliseconds.
Severe: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
Severe: SLF4J: Defaulting to no-operation (NOP) logger implementation
Severe: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Severe: Exception in thread "RateLimitExecutorDelayThread"
Severe: java.lang.NoSuchMethodError: com.google.common.util.concurrent.RateLimiter.acquire()D
at com.google.maps.internal.RateLimitExecutorService.run(RateLimitExecutorService.java:75)
at java.lang.Thread.run(Thread.java:745)
你能解决吗? – TimSchwalbe
@TimSchwalbe是的,我终于能够解决它。我使用旧版本,因为谷歌API版本0.2.1有一个线程问题。 https://github.com/googlemaps/google-maps-services-java/issues/287#issuecomment-321938011 – qualebs