Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Module not working well with maplibre-gl-native sdk for android. #8

Open
SumedhShriram opened this issue Apr 27, 2021 · 16 comments
Open

Comments

@SumedhShriram
Copy link

Android API:
Mapbox Navigation SDK version:

Steps to trigger behavior

  1. add dependencies
    1.1 implementation 'org.maplibre.gl:android-sdk:9.4.0'
    1.2 implementation 'com.graphhopper:graphhopper-navigation-android-ui:0.1.0-SNAPSHOT'
  2. sync gradle
  3. import in MainActivity
    import com.mapbox.api.directions.v5.models.DirectionsRoute;
    import com.mapbox.geojson.Point;
    import com.mapbox.mapboxsdk.Mapbox;
    import com.mapbox.mapboxsdk.annotations.Marker;
    import com.mapbox.mapboxsdk.location.LocationComponent;
    import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions;
    import com.mapbox.mapboxsdk.location.LocationComponentOptions;
    import com.mapbox.mapboxsdk.location.modes.CameraMode;
    import com.mapbox.mapboxsdk.location.modes.RenderMode;
    import com.mapbox.mapboxsdk.location.permissions.PermissionsListener;
    import com.mapbox.mapboxsdk.location.permissions.PermissionsManager;
    import com.mapbox.mapboxsdk.maps.MapView;
    import com.mapbox.mapboxsdk.maps.MapboxMap;
    import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
    import com.mapbox.mapboxsdk.maps.Style;
    import com.mapbox.services.android.navigation.v5.utils.LocaleUtils;
  4. build app

Expected behavior

Navigating between 2 Points

Actual behavior

Duplicate Classes issue when using "graphhopper android navigation ui" with maplibre android sdk 9.4
OR
on excluding mapbox-android-sdk while implementing "graphhopper android navigation ui"
jetified-graphhopper-navigation-android-ui-0.1.0-SNAPSHOT/res/layout/navigation_view_layout.xml:10: AAPT: error: attribute mapbox_styleUrl (aka mapsapp:mapbox_styleUrl) not found.

@karussell
Copy link
Contributor

This repo is not yet compatible with maplibre SDK. See #6.

Maybe you have the knowledge to make this working and contribute code changes or maybe some guide to do?

@vlkpa
Copy link

vlkpa commented Apr 29, 2021

Any idea why am I able to run graphhopper-navigation-example but when I want to customize it (with implementation 'com.graphhopper:graphhopper-navigation-android-ui:0.1.0-SNAPSHOT') I got this mapbox_styleUrl not found error

@SumedhShriram
Copy link
Author

Any idea why I am able to run graphhopper-navigation-example but when I want to customize it (with implementation 'com.graphhopper:graphhopper-navigation-android-ui:0.1.0-SNAPSHOT') I got this mapbox_styleUrl not found error

which maplibre sdk are you using?

@vlkpa
Copy link

vlkpa commented Apr 30, 2021

I dont have maplibre import in my gradle (like in the graphopper navigation example), but I tried it with all o them (9.2.1, 9.3.0, 9.4.0), you were able to build it with some version? If I am missing something, sorry for misunderstanding, I am noob in this field (my goal is to create bridge from android into react native doesn't matter how).

@kabilsharma
Copy link

kabilsharma commented May 29, 2021

GUYS WE TRIED TO FIX THIS WITH ALTERNATIVE WAY- WORKING ON UPGRADIG OUR OWN VERSION WILL RELEASE SOON IN PR- FOR STARTERS YOU CAN CHECK THIS

https://github.com/DroidsOnRoids/graphhopper-navigation-android/packages/649651

THESE GUSYS DROIDS N DROIDS HAS UPGRADED THIS REPO AND CREATED A COMPATIBLE VERSION WITH MAPLIBRE SDK 9.2.1. WE HAVE CHECKED IT OURSELVES IT WORKS SO SMMOTH AND ACCURATE WHEN IT COMES TO REALT TIME LOCATION WHILE NAVIGATION OR REROUTING .

BUT THEY DONT HAVE UI WITH THIS PACKAGE SO WE HAVE TO USE ANOTHER PACKAGE FOR UI

https://mvnrepository.com/artifact/com.mapbox.mapboxsdk/mapbox-android-navigation-ui

SO BASICALLY A MIXTURE OF THREE SOURCES FOR NOW - NOT PROUD OF OUR WORK FOR NOW BUT THE APP WORKS SMOOTHILY. WHAT WE CAN SAY.

BASICALL

mAPLIBRE SDK + DROIDS AND DROIDS PACKAGE (FOR NAVIGATION CORE PART) + mAPBOX UI PACKAGE (OPEN SOURCE ONE).

WILL SHARE COMPLETE SOURCE PACKAGE HERE ONCE IT IS BUGS FREE .

OPEN FOR SUGGESSTIONS.

@SumedhShriram
Copy link
Author

I did the same. Used maplibre-9.4.0 sdk along and mapbox navigation ui 0.42.6 for the tbt navigation. what i did is pretty custom. I'll try creating a separate repo for it and post it here once I separate my components and custom code from it.
Little buggy, will share mine once it's done.
It can use custom vector maps sourcing such as from TileServer-GL or maptiler server. Also TBT uses graphhopper server.

Cheers guys!

PS: nice work @kabilsharma

@boldtrn
Copy link
Contributor

boldtrn commented May 31, 2021

It's great to hear that you made progress with updating the code. It would be great if you could provide a PR for this once you have a reasonably well working set up :).

@kabilsharma
Copy link

I did the same. Used maplibre-9.4.0 sdk along and mapbox navigation ui 0.42.6 for the tbt navigation. what i did is pretty custom. I'll try creating a separate repo for it and post it here once I separate my components and custom code from it.
Little buggy, will share mine once it's done.
It can use custom vector maps sourcing such as from TileServer-GL or maptiler server. Also TBT uses graphhopper server.

Cheers guys!

PS: nice work @kabilsharma

Could you please share your edits. our work gives lots of bugs and issues.

@viktorgt
Copy link

viktorgt commented Aug 27, 2021

I forked the flitsmeister-navigation-android, since they have already replaced location layer plugin by location component and removed mapbox telemetry. Flitsmeister still depends on the old mapbox libraries and navigation-ui is missing. I added navigation-ui from mapbox 0.42 with some other changes. Afterwards, I ported it from mapbox to maplibre: https://github.com/sw-code/flitsmeister-navigation-android

We are using it for our city tourism application, which includes in-app-navigation. We would be happy to contribute to maplibre.
Please let me know if you would like to include it into this repository.

@karussell
Copy link
Contributor

This is really cool - thanks! We should definitely get in touch to discuss this. As it seems that your code is already working with maplibre and has also more features (guessing from the screenshot). I just sent an Email to your company. This would be also an interesting topic to discuss in the Maplibre meeting this Thursday where you could join.

@viktorgt
Copy link

You can try it out. I added also some samples from mapbox to the sample app. There are already three samples working, I did not manage to finish the fourth yet. You have to provide the configuration via the developer-config.xml:

<resources>
    <string name="mapbox_access_token">pk.GRAPHHOPPER_API_TOKEN</string>

    <!-- This is the endpoint for the routing API, please note this endpoint might change in the future, please contact GraphHopper if you want to publish an app using this endpoint-->
    <string name="base_url" translatable="false">https://graphhopper.com/api/1/navigate/</string>

    <string name="map_view_styleUrl" translatable="false">https://api.maptiler.com/maps/streets/style.json?key=MAP_TILER_API_TOKEN</string>
</resources>

@karussell
Copy link
Contributor

Thank you. This works for me.

I had to rename libandroid-navigation-ui/src/test/java/com/mapbox/services/android/navigation/ui/v5/map/MapWaynameTest.java to MapWayNameTest before I got it working on Linux.

Do you know what it means when a notification comes ala "found 4 retained objects grouped as 2 distinct leaks" is shown? (source of this seems to be NavigationLocationEngineListener calling MapboxNavigation which leaks the NavigationService instance)

Flitsmeister still depends on the old mapbox libraries and navigation-ui is missing.

Did you add this from the old open source version and are there any dependencies to the latest mapbox libraries? And is it still without telemetry and binary blobs etc? I.e. the only mapbox dependencies are geojson and turf?

@viktorgt
Copy link

viktorgt commented Sep 1, 2021

Sorry for this case sensitivity issue.

Do you know what it means when a notification comes ala "found 4 retained objects grouped as 2 distinct leaks" is shown? (source of this seems to be NavigationLocationEngineListener calling MapboxNavigation which leaks the NavigationService instance)

The notification is from leak canary. It is enabled in debug mode. I fixed a lot of the leaks mapbox had, but some may still exist and some are minor and have no effect on the app.

Did you add this from the old open source version and are there any dependencies to the latest mapbox libraries? And is it still without telemetry and binary blobs etc? I.e. the only mapbox dependencies are geojson and turf?

Yes, I added it from the old open source version. The navigation has no direct dependencies to mapbox anymore. If I check the dependencies tree, there are still two transitive dependencies to mapbox: com.mapbox.mapboxsdk:mapbox-android-accounts and com.mapbox.mapboxsdk:mapbox-android-gestures from org.maplibre.gl:android-sdk.

@viktorgt
Copy link

viktorgt commented Oct 9, 2021

I fixed the issue with MapWaynameTest and offroute handling in the navigation UI. Right now we are also working on the iOS part with direct MapLibre integration. Looks promising :)

@SeanBlevins
Copy link

I fixed the issue with MapWaynameTest and offroute handling in the navigation UI. Right now we are also working on the iOS part with direct MapLibre integration. Looks promising :)

Do you plan to create a pull request?
I would be very interested in a new version of mablibre with your fixes

@karussell
Copy link
Contributor

karussell commented Dec 17, 2021

See also recent discussion at maplibre/maplibre#7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants