Skip to content

Conversation

@danesfeder
Copy link
Contributor

@danesfeder danesfeder commented Feb 12, 2018

Closes #891 Closes #880 Closes #837 Closes #746

Currently not compiling due to a dex error with something related to offline

cc @osana @cammace (for 👀 on the NavigationMapRoute code)

@danesfeder
Copy link
Contributor Author

@tobrun any ideas here?

Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/danesfeder/.gradle/caches/transforms-1/files-1.1/mapbox-android-sdk-6.0.0-SNAPSHOT.aar/0db8873ff2b10dc56820a1208701e197/jars/classes.jar

Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing com/mapbox/mapboxsdk/offline/OfflineRegion$2.class

Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)```

@danesfeder
Copy link
Contributor Author

Found the issue:

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

Needed to be added to the test app.

PropertyFactory.iconImage(match(
get("waypoint"),
literal("originMarker"), literal("stop"), literal("originMarker"),
literal("destination"), literal("destinationMarker")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conversion doesn't seem correct:

match(
get("waypoint"),
literal("origin"), literal("originMarker"),
literal("destination"), literal("destinationMarker"),
literal("defaultOutputIfAboveDoesntMatch")
)

Copy link
Contributor Author

@danesfeder danesfeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far - after talking with @Guardiola31337, we need to keep this PR up to date with master, while we wait for the libraries that libandroid-navigation-ui depend on to be released. Currently, this PR is using specific SNAPSHOTS in order to build correctly. Biggest piece left here, imo, is removing all of the telem hardcoded values with the proper methods from the telem library.

public class MainActivity extends AppCompatActivity implements PermissionsListener {

// TODO Check and remove if not necessary
private static final String[] PERMISSIONS = {Manifest.permission.ACCESS_FINE_LOCATION,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed: can be removed 👍

mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 12));
mapboxMap.setMyLocationEnabled(true);
mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
// TODO Check and remove if not necessary
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed deprecated code: can be removed 👍

private void calculateRoute() {
Location userLocation = mapboxMap.getMyLocation();
// TODO Check
Location userLocation = locationEngine.getLastLocation();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed this is good to replace 👍

navigationEventListeners = new ArrayList<>();
milestoneEventListeners = new ArrayList<>();
progressChangeListeners = new ArrayList<>();
progressChangeListeners = new CopyOnWriteArrayList<>();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do the same for the rest of the lists, great catch here 💯

package com.mapbox.services.android.navigation.v5.utils;


// TODO Check and remove if not necessary
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are using these methods in the nav SDK and they are no longer provided by the libraries we are using, let's add them to our utils

@danesfeder
Copy link
Contributor Author

@Guardiola31337 taking a look at the map route changes and found that the start/end points are missing now in this branch:

screenshot_1520979905

stop("destination", PropertyFactory.iconImage("destinationMarker"))
PropertyFactory.iconImage(match(
get("waypoint"),
literal("originMarker"), literal("originMarker"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the first originMarker should be "origin"

get("waypoint"),
literal("originMarker"), literal("originMarker"),
literal("destination"), literal("destinationMarker"),
literal("defaultOutputIfAboveDoesntMatch")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to actually assign a real icon id value for above, eg. originMarker

@Guardiola31337
Copy link
Contributor

While testing the integration noticed that routes are not drawn properly 👇

draw_routes_issue

This is the MockNavigationActivity from the test app (tapping the map twice). Note that black color in the route after placing the second waypoint.

Comparing with master (Maps SDK 5.5.0 at the moment of writing) 👇

draw_routes_5_5

it seems that we're messing up with Expressions related code. Going to dig deeper. BTW, it'd be great @tobrun if you could take a look at it as well and let us know if you 👀 something missing or wrong. Thanks 🙏

@tobrun
Copy link
Member

tobrun commented Apr 12, 2018

it seems that we're messing up with Expressions related code. Going to dig deeper. BTW, it'd be great @tobrun if you could take a look at it as well and let us know if you 👀 something missing or wrong. Thanks

A quick glance over the code found here didn't flag anything to me.
Could you specify/link which layer configuration is not working correctly?

@Guardiola31337
Copy link
Contributor

@tobrun

Could you specify/link which layer configuration is not working correctly?

We're adding the route layer to the map either using the custom style values or the default in NavigationMapRoute#addRouteLayer and the code in which we "paint" the traffic colors is

PropertyFactory.lineColor(match(
get(CONGESTION_KEY),
literal("moderate"), color(index == primaryRouteIndex ? routeModerateColor : alternativeRouteModerateColor),
literal("heavy"), color(index == primaryRouteIndex ? routeSevereColor : alternativeRouteSevereColor),
literal("severe"), color(index == primaryRouteIndex ? routeSevereColor : alternativeRouteSevereColor),
color(index == primaryRouteIndex ? routeDefaultColor : alternativeRouteDefaultColor))
)

We don't draw black on the route line at any time. Leading me to believe this is an issue with the Maps SDK or how we are using it.

Route using Maps SDK 5.5.0 vs 6.0.0 👀

route_5_5

route_6_0

Any hints? Couldn't find anything wrong either 😞

@Guardiola31337
Copy link
Contributor

Noting here that when testing mapbox/mapbox-plugins-android#424 (comment) noticed some building conflicts 👀

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'android.arch.lifecycle:runtime' has different version for the compile (1.0.3) and runtime (1.1.1) classpath. You should manually set the same version via DependencyResolution

We aren't using 1.1.1 (LLP included it in mapbox/mapbox-plugins-android#419) so in order to avoid them we needed to include implementation "android.arch.lifecycle:extensions:1.1.1" in the app's build.gradle file. We should fix it in the Nav side though (bumping the version). Ticket to follow.

@tobrun
Copy link
Member

tobrun commented Apr 16, 2018

Note that with final release of LLP this shouldn't be an issue anymore, with mapbox/mapbox-plugins-android#419 we limited the scope of the included dependency.

@Guardiola31337
Copy link
Contributor

@tobrun

Note that with final release of LLP this shouldn't be an issue anymore, with mapbox/mapbox-plugins-android#419 we limited the scope of the included dependency.

What do you mean with we limited the scope of the included dependency?

I think this will be an issue in the Nav side (when including LLP final release dependency) until #864 gets addressed.

@danesfeder
Copy link
Contributor Author

@Guardiola31337 I'd look at NavigationMapRoute#generateFeatureCollectionList. I'm wondering if the issue with the route line has to do with how we generate the features a second time, or with waypoints.

@Guardiola31337
Copy link
Contributor

old_current_events_libs_comparison_whole_route

Green 👉 New implementation
Yellow 👉 Old implementation

In terms of numbers we're getting 99 events with the old implementation whereas 95 events with the new implementation. Above the green points can't be seen because they're right under the yellow ones (i.e. same exact location). As you can see below the differences only happened at the beginning right before starting the navigation session.

old_current_events_libs_comparison_beginning

Here we're only 🕵️ the location events, it'd be great to do the same with the Nav-related events.

BTW, based on what we're 👀 with the location events seems legit to go ahead and merge the PR. We can revisit/continue analyzing the navigation events later.

cc @danesfeder @zugaldia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants