[GraphHopper] App crashed getting response from GraphHopperAPI.rout(request)

Peter K peathal at yahoo.de
Thu May 2 15:05:41 UTC 2013


I don't like to repeat myself but why not start with the demo app?
Are you using eclipse or the maven based dependencies? If eclipse then
you should only have graphhopper-android.jar as dependency (+
slf4j-android + mapsforge)

If you want that I can help you should provide more insights into what
you've done (step by step) to reproduce the problem.

Peter.

> Please ignore previous mail that has been resolved now i am getting
> error at  
>
> tmpHopp.load(mapsFolder + currentArea);
>
>
>
> 05-02 16:10:14.747: I/dalvikvm(20747): Could not find method
> org.slf4j.LoggerFactory.getLogger, referenced from method
> com.graphhopper.util.Helper.<clinit>
> 05-02 16:10:14.747: W/dalvikvm(20747): VFY: unable to resolve static
> method 31137: Lorg/slf4j/LoggerFactory;.getLogger
> (Ljava/lang/Class;)Lorg/slf4j/Logger;
> 05-02 16:10:14.747: D/dalvikvm(20747): VFY: replacing opcode 0x71 at
> 0x0002
> 05-02 16:10:14.757: I/dalvikvm(20747): Could not find method
> org.slf4j.Logger.warn, referenced from method
> com.graphhopper.util.Helper.loadProperties
> 05-02 16:10:14.757: W/dalvikvm(20747): VFY: unable to resolve
> interface method 31136: Lorg/slf4j/Logger;.warn (Ljava/lang/String;)V
> 05-02 16:10:14.757: D/dalvikvm(20747): VFY: replacing opcode 0x72 at
> 0x003e
> 05-02 16:10:14.767: W/dalvikvm(20747): Exception
> Ljava/lang/NoClassDefFoundError; thrown while initializing
> Lcom/graphhopper/util/Helper;
>
>
>
>
>
>
> On Thu, May 2, 2013 at 4:00 PM, Awais Bin Asif
> <09bicsebasif at seecs.edu.pk <mailto:09bicsebasif at seecs.edu.pk>> wrote:
>
>     i have only integrated prepareGraph() function from graphhopper
>     project.
>
>
>      
>
>     void prepareGraph() {
>      Log.d("Awais", "1");
>             logUser("loading graph (" + Constants.VERSION + "|" +
>     Constants.VERSION_FILE
>                     + ") ... ");
>             Log.d("Awais", "2");
>             new GHAsyncTask<Void, Void, Path>() {
>                 protected Path saveDoInBackground(Void... v) throws
>     Exception {
>                 Log.d("Awais", "3");
>                     GraphHopper tmpHopp = new GraphHopper().forMobile();
>                     tmpHopp.contractionHierarchies(true);
>                     tmpHopp.load(mapsFolder + currentArea);
>                     log("found graph with " + tmpHopp.graph().nodes()
>     + " nodes");
>                     hopper = tmpHopp;
>                     return null;
>                 }
>
>                 protected void onPostExecute(Path o) {
>                     if (hasError()) {
>                         logUser("An error happend while creating graph:"
>                                 + getErrorMessage());
>                     } else {
>                         logUser("Finished loading graph. Touch to
>     route.");
>                     }
>
>                   //  finishPrepare();
>                 }
>             }.execute();
>         }
>
>
>
>     i have place different Log.d() in the code but i found that after
>      Log.d("Awais", "1");  app crashed. 
>
>
>
>     On Thu, May 2, 2013 at 3:49 PM, Awais Bin Asif
>     <09bicsebasif at seecs.edu.pk <mailto:09bicsebasif at seecs.edu.pk>> wrote:
>
>         Errors
>
>
>         05-02 15:48:52.627: E/AndroidRuntime(14090): FATAL EXCEPTION: main
>         05-02 15:48:52.627: E/AndroidRuntime(14090):
>         java.lang.ExceptionInInitializerError
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         com.example.easytravelling.MainActivity.prepareGraph(MainActivity.java:158)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         com.example.easytravelling.MainActivity.onCreate(MainActivity.java:84)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.app.Activity.performCreate(Activity.java:4465)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.app.ActivityThread.access$600(ActivityThread.java:127)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.os.Handler.dispatchMessage(Handler.java:99)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.os.Looper.loop(Looper.java:137)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         android.app.ActivityThread.main(ActivityThread.java:4448)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         java.lang.reflect.Method.invokeNative(Native Method)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         java.lang.reflect.Method.invoke(Method.java:511)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         dalvik.system.NativeStart.main(Native Method)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): Caused by:
>         java.lang.ExceptionInInitializerError
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         com.example.easytravelling.Constants.<clinit>(Constants.java:56)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): ... 16 more
>         05-02 15:48:52.627: E/AndroidRuntime(14090): Caused by:
>         java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
>         05-02 15:48:52.627: E/AndroidRuntime(14090): at
>         com.graphhopper.util.Helper.<clinit>(Helper.java:47)
>         05-02 15:48:52.627: E/AndroidRuntime(14090): ... 17 more
>
>
>
>         On Thu, May 2, 2013 at 3:37 PM, Awais Bin Asif
>         <09bicsebasif at seecs.edu.pk <mailto:09bicsebasif at seecs.edu.pk>>
>         wrote:
>
>             I have tried your instruction to
>             create graphhopper-0.1-SNAPSHOT-android.jar file. But i am
>             still getting the same errors now i have
>
>             graphhopper-0.1-SNAPSHOT-android.jar
>              graphhopper-0.1-SNAPSHOT.jar 
>             graphhopper-0.1-SNAPSHOT-jar-with-dependency.jar  
>
>             in Android Dependencies
>
>
>
>
>
>
>
>             On Mon, Apr 29, 2013 at 11:30 AM, Peter K
>             <peathal at yahoo.de <mailto:peathal at yahoo.de>> wrote:
>
>                 AStar can be used like it is described in the wiki:
>                 https://github.com/graphhopper/graphhopper/wiki/Low-Level-API
>                 Instead of DijkstraSimple use AStar
>
>                 But be aware that the normal algorithms will require
>                 more RAM than the contraction hierarchy* optimized ones.
>                 So only mid-sized countries are possible on a mobile
>                 platform as our AStar still is exact and does not e.g.
>                 throw away too-far-away points to reduce memory
>                 consumption.
>
>                 Regards,
>                 Peter.
>
>                 *
>                 http://lists.openstreetmap.org/pipermail/graphhopper/2013-April/000057.html
>
>
>
>>                 Yes the demo app is working fine. Basically i want to
>>                 integrate it in my Android app. I want to develop an
>>                 Android app which gives offline navigation. But now i
>>                 am trying to run the demo code first. And one more
>>                 thing i want to ask there is AStar.java file upload
>>                 at https://github.com/graphhopper/graphhopper/blob/master/src/main/java/com/graphhopper/routing/AStar.java
>>
>>
>>                 can i use this algorithm for android app offline
>>                 route planning.?????
>>
>>
>>                 On Sun, Apr 28, 2013 at 1:22 AM, Peter K
>>                 <peathal at yahoo.de <mailto:peathal at yahoo.de>> wrote:
>>
>>                     Please let me know the error and what you changed
>>                     to better guide you ...
>>
>>
>>                     > Then i took two parts of the code
>>
>>                     You tried to integrate it in your own
>>                     application? Is the demo app working for you? Try
>>                     starting from there and iterate ...
>>
>>>
>>>                      Now i don't know the implementation of
>>>                     GraphHopperAPI.rout(req) so how can i figure
>>>                     this out.
>>>
>>
>>                     But this is in the source code!?
>>
>>
>>                     Regards,
>>                     Peter.
>>
>>
>>
>>>                     I am trying to run the code Graphhopper-Android
>>>                     from https://github.com/graphhopper/graphhopper-android using
>>>                     berlin-gh graph file available
>>>                     at https://code.google.com/p/graphhopper/downloads/list 
>>>
>>>
>>>                     First i tried to load the .map file and
>>>                     it successfully loaded. it showed the brelin's map
>>>
>>>                     Then i took two parts of the code 
>>>                     PrepareGraph()
>>>                     calcPath()
>>>
>>>                     Prepare graph makes toast "*Finished loading
>>>                     graph. Touch to route*" thats mean graph
>>>                     loaded successfully. in calcPath() function App
>>>                     crashed at 
>>>
>>>                      GHResponse resp = hopper.route(req);  while
>>>                     getting response.
>>>
>>>                     where hopper is *GraphHopperAPI hopper*;
>>>                     and for request i hard coded the lat lon from map.
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20130502/91d9535d/attachment-0001.html>


More information about the GraphHopper mailing list