-
Notifications
You must be signed in to change notification settings - Fork 18
RuntimeException when running sample code (Problem while fetching path [49.6724,11.3494, 49.655,11.418]: null) #7
Comments
Thanks - I'll investigate! |
It seems that the exception happens even before any HTTP request leaves my Android device - I've set up Charles proxy and it does not show any communication when the exception reproduces. |
The sample code itsef still runs fine here. The probem is highly likely something related to Android. OkHttpClient fails to fetch the content at this line in GraphHopperWeb String str = downloader.newCall(okRequest).execute().body().string(); Can you print here the
Strange. Would you mind to make sure you do not encounter something like this here: http://stackoverflow.com/questions/13390026/android-socket-connection-fail |
Yes, this may be it as in the log I provided above there is
I'll make sure tomorrow if this is the problem, anyway I thought this client does some background threading by itself. |
No. It it intended for usage in any environment like desktop/server/android and the client has to make sure it will be called properly according to the environment requirements BTW: changing the timeout shoud NOT be required. Results should come always within milliseconds:
|
Yes, this was problem with my code calling your example on main thread - calling it from non main thread works fine. However it may be helpful to either:
|
Would you try again the wrong approach on the thread and change the code: to Object o = downloader.newCall(okRequest).execute().body();
if(o == null)
throw new IllegalStateException("Response body is empty. Maybe issue #7?");
String str = body.toString(); If this is the reason I'll fix the code and also include a notice in the readme |
@farmazon3000 Sorry to bother you again but as Android is not my main target: would you try this fix? |
Closing here for now |
When I run the example code on Android with
I'm getting an exception
The text was updated successfully, but these errors were encountered: