GraphHopper.com | Forum | GitHub | Maps | Blog

Reduce Number of Dependencies for Client-HC


#1

Currently, client-hc has a dependency to graphhopper-web-api which has a dependency to dropwizard-jackson (which in turn ads many dependencies like guava).

This results in issues when using the client-hc on mobile devices (for example Android).

IMHO, the client should be a very slim dependency that you can add to any project without requiring too add too many transitive dependencies.

On Android there is the issue of Multidexing when reaching more than 64k methods. Multidexing can have a negative impact and it’s recommended to avoid it, if possible.

So I was wondering if it would be possible to convert the client-hc into a slimmer version, maybe we need to to the json conversion by hand, instead of using Jackson and guava, which would remove most dependencies.

WDYT?


#2

Interesting.

@michaz is there a reason we do not use jackson directly and use dropwizard-jackson instead?

maybe we need to to the json conversion by hand

This is no option. Is jackson alone also heavy weight? Or we make it switchable and one could use bson if this would be simpler.


#3

Not so much, plus jakcson being the obvious lib for json is used anyway, contrary to dropwizard dependencies on mobile or desktop.
Probably there is quite mix of the platforms in architecture here.

Made a quick test on weekend with 0.11 and results were pretty disappointing… non less than around 12 new dependencies are needed now for client-hc to work on any platform.
That naturally cannot be accepted or used in apps, so reverted quickly and plan to stay with 0.10. :confused:


#4

@devemux86 thanks for your feedback, have created an issue: https://github.com/graphhopper/graphhopper/issues/1443


#5

Only that it bundles those parts of Jackson (there are many individual artifacts…) which Dropwizard wants. Meaning that when you use it inside of a Dropwizard app, you don’t get version conflicts. But that’s only a minor thing and shouldn’t break Android, obviously.

When I look at dropwizard-jackson, I see:

  • Jackson stuff
  • Guava
  • Joda Time
  • Some annotations

Which of these is a problem?


#6

And no, I see no problems with hand-picking parts of Jackson instead.

It’s only that I was under the impression that I already got as close to the metal as necessary. Wrongly, apparently.


#7

Let’s just do it.