graphhopper / graphhopper-navigation-example-legacy

GraphHopper Navigation as App
https://www.graphhopper.com/open-source/
Apache License 2.0
93 stars 49 forks source link

Simple getting started tutorial #39

Open karussell opened 5 years ago

karussell commented 5 years ago

See the tutorial here. Here we collect some of the issues.

karussell commented 5 years ago

I fixed the linux problem via:

sudo apt-get install adb
sudo adb kill-server
sudo adb start-server
# now reconnecting the device
boldtrn commented 5 years ago

the emulator does not seem to work

Yes, I usually a hardware device to run it. I only had bad experiences with the emulator (also in other projects).

ahamed-musthafa commented 5 years ago

I'm getting below error while building the project. Can you please take a look?

ERROR: Failed to resolve: com.graphhopper:graphhopper-navigation-android-ui:0.1.0-SNAPSHOT
Affected Modules: app

=====
Executing tasks: [assemble]

:app:buildInfoDebugLoader
:app:checkDebugClasspath FAILED
:app:buildInfoGeneratorDebug

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.graphhopper:graphhopper-navigation-android-ui:0.1.0-SNAPSHOT.
  Searched in the following locations:
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/maven-metadata.xml
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.pom
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.jar
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/google/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/maven-metadata.xml
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/google/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.pom
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/google/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.jar
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/android/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/maven-metadata.xml
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/android/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.pom
      file:/Users/ahamed.musthafa/Library/Android/sdk/extras/android/m2repository/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.jar
      https://dl.google.com/dl/android/maven2/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/maven-metadata.xml
      https://dl.google.com/dl/android/maven2/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.pom
      https://dl.google.com/dl/android/maven2/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.jar
      https://jcenter.bintray.com/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/maven-metadata.xml
      https://jcenter.bintray.com/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.pom
      https://jcenter.bintray.com/com/graphhopper/graphhopper-navigation-android-ui/0.1.0-SNAPSHOT/graphhopper-navigation-android-ui-0.1.0-SNAPSHOT.jar
  Required by:
      project :app

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
3 actionable tasks: 3 executed
=====
boldtrn commented 5 years ago

You should be able to fix this by adding maven { url "https://oss.sonatype.org/content/repositories/snapshots" } in a new line here.

ahamed-musthafa commented 5 years ago

Excellent, it works! Thanks a lot for super quick response.

karussell commented 5 years ago

There is issue #27 happening for me when installing this from IDE. @boldtrn you said

For now this is fixed by passing the gh key as Mapbox key to the Navigation SDK

Can you outline where exactly the change is necessary?

mapotu26 commented 5 years ago

When trying to clone the project, I get an error in the "Events" section of Android Studio once installed. The error is: "Cannot run Git". File not found:git.exe. Please help :) I copied the link and rewrote it myself and still the same error Android Studio error

boldtrn commented 5 years ago

@mapotu26 you will need to install git. This seems completely unrelated to this project. For relevant question, please let us know in our forum.

DakastaKay commented 5 years ago

in the README.md is says:

Note: while it's possible to use raster tiles, we recommend vector tiles for mobile applications.

But in the tutorial it does not mention it.

Is there a way to use raster tiles like https://a.tile.openstreetmap.org/${z}/${x}/${y}.png ?

edit: i guess it should work something like: adding a style.json to assets with following content: { "version": 8, "sources": { "raster-tiles": { "type": "raster", "tiles": ["https://a.tile.openstreetmap.org/${z}/${x}/${y}.png "], "tileSize": 256 } }, "layers": [{ "id": "simple-tiles", "type": "raster", "source": "raster-tiles", "minzoom": 0, "maxzoom": 22 } ] }

and than setting in developer-config.xml <string name="map_view_styleUrl" translatable="false">file:///android_asset/style.json</string>

but i get the error

loading style failed:

and no tiles are loaded

boldtrn commented 5 years ago

Something like this should work:

style: {
"version": 8,
"sources": {
"raster-tiles": {
"type": "raster",
"tiles": ["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg"],
"tileSize": 256,
"attribution": 'Map tiles by <a target="_top" rel="noopener" href="http://stamen.com">Stamen Design</a>, under <a target="_top" rel="noopener" href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a target="_top" rel="noopener" href="http://openstreetmap.org">OpenStreetMap</a>, under <a target="_top" rel="noopener" href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
}
},
"layers": [{
"id": "simple-tiles",
"type": "raster",
"source": "raster-tiles",
"minzoom": 0,
"maxzoom": 22
}]
}
DakastaKay commented 5 years ago

Something like this should work:

style: {
"version": 8,
"sources": {
"raster-tiles": {
"type": "raster",
"tiles": ["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg"],
"tileSize": 256,
"attribution": 'Map tiles by <a target="_top" rel="noopener" href="http://stamen.com">Stamen Design</a>, under <a target="_top" rel="noopener" href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a target="_top" rel="noopener" href="http://openstreetmap.org">OpenStreetMap</a>, under <a target="_top" rel="noopener" href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
}
},
"layers": [{
"id": "simple-tiles",
"type": "raster",
"source": "raster-tiles",
"minzoom": 0,
"maxzoom": 22
}]
}

Thank you for your input. It seems like the only difference to mine is the attributions line. I tested it and it still doesn't work. Any other suggestions? Thanks.

edit:

I tested some more and i get it to work with the url like: "tiles": ["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg"], and attribution like: "attribution": "Map tiles by <a target=\"_top\" rel=\"noopener\" href=\"http://stamen.com\">Stamen Design</a>, under <a target=\"_top\" rel=\"noopener\" href=\"http://creativecommons.org/licenses/by/3.0\">CC BY 3.0</a>. Data by <a target=\"_top\" rel=\"noopener\" href=\"http://openstreetmap.org\">OpenStreetMap</a>, under <a target=\"_top\" rel=\"noopener\" href=\"http://creativecommons.org/licenses/by-sa/3.0\">CC BY SA</a>" but only with the style.json on an external source on a web-server and not as asset with a url: file:///android_asset/style.json