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