Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Multiple version bump hotfixes #643

Merged
merged 24 commits into from
Mar 6, 2018
Merged

Conversation

langsmith
Copy link
Contributor

This pr fixes many broken APIs, import lines, and other refactoring that are all related to recent changes in our tools (Mapbox Java, plugins, etc.). For some reason, CircleCI didn't catch this 😟

@snijsure
Copy link

snijsure commented Mar 5, 2018

@langsmith I am trying to run demo app on my pixel and keep getting following exception when running on master branch as well as ls-multiple-version-bump-hotfixes branch

I am at commit 03bef9d485e79195ac7471d9f3c44b7fd50fbf69

I am running command ./gradlew clean installDebug to build & install demo app.

Error I see is this:

03-05 14:59:38.477 26163 26163 E AndroidRuntime: Process: com.mapbox.mapboxandroiddemo, PID: 26163
03-05 14:59:38.477 26163 26163 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mapbox.mapboxandroiddemo/com.mapbox.mapboxandroiddemo.MainActivity}: java.lang.IllegalStateException: Could not find wearable shared library classes. Please add <uses-library android:name="com.google.android.wearable" android:required="false" /> to the application manifest
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.ActivityThread.-wrap11(Unknown Source:0)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:164)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6494)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Could not find wearable shared library classes. Please add <uses-library android:name="com.google.android.wearable" android:required="false" /> to the application manifest
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.support.wearable.internal.SharedLibraryVersion.verifySharedLibraryPresent(SharedLibraryVersion.java:39)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.support.wearable.activity.WearableActivityDelegate.initAmbientSupport(WearableActivityDelegate.java:137)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.support.wearable.activity.WearableActivityDelegate.onCreate(WearableActivityDelegate.java:34)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.support.wearable.activity.WearableActivity.onCreate(WearableActivity.java:53)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at com.mapbox.mapboxandroiddemo.MainActivity.onCreate(MainActivity.java:31)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:6999)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:6990)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
03-05 14:59:38.477 26163 26163 E AndroidRuntime: 	... 9 more
03-05 14:59:38.480   877  2506 W ActivityManager:   Force finishing activity com.mapbox.mapboxandroiddemo/.MainActivity

@langsmith
Copy link
Contributor Author

langsmith commented Mar 5, 2018

Thanks @snijsure , putting out multiple 🔥 right now but will definitely look into it and get back to you.

Ticketed here for future work/tracking

.gitignore Outdated
@@ -11,3 +11,4 @@ build
gradlew.bat
*.properties
src/main/res/
MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/account/AccountRetrievalService.java
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this being added to the gitignore file? Any chance you could add a comment above it explaining what the file is and why it's not being checked in to git?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed from gitignore file. Was part of an experiment 🔬

@@ -129,7 +132,11 @@ protected void onSaveInstanceState(Bundle outState) {
inputStream.close();
FeatureCollection featureCollection = FeatureCollection.fromJson(sb.toString());
LineString lineString = (LineString) featureCollection.getFeatures().get(0).getGeometry();
points = lineString.getCoordinates();
for (int x = 0; x < lineString.getCoordinates().size(); x++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use foreach here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -181,16 +186,16 @@ public void onResponse(Call<MapMatchingResponse> call, Response<MapMatchingRespo
// Convert the map matched response list from position to latlng coordinates.
// By default, the SDK uses MapMatchingCriteria.GEOMETRY_POLYLINE_6, therefore
// you need Constants.PRECISION_6 for the decode to be right
String geometry = response.body().getMatchings().get(0).getGeometry();
String geometry = response.body().matchings().get(0).geometry();
List<Position> positions = PolylineUtils.decode(geometry, Constants.PRECISION_6);
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be Point right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PolylineUtils.decode returns List<Position>

@@ -181,16 +186,16 @@ public void onResponse(Call<MapMatchingResponse> call, Response<MapMatchingRespo
// Convert the map matched response list from position to latlng coordinates.
// By default, the SDK uses MapMatchingCriteria.GEOMETRY_POLYLINE_6, therefore
// you need Constants.PRECISION_6 for the decode to be right
String geometry = response.body().getMatchings().get(0).getGeometry();
String geometry = response.body().matchings().get(0).geometry();
List<Position> positions = PolylineUtils.decode(geometry, Constants.PRECISION_6);
if (positions == null) {
return;
}

for (int i = 0; i < positions.size(); i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Convert to foreach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -174,7 +175,7 @@ public void onFailure(Call<DirectionsMatrixResponse> call, Throwable throwable)
private void addMarkers() {
Icon lightningBoltIcon = IconFactory.getInstance(MatrixApiActivity.this)
.fromResource(R.drawable.lightning_bolt);
for (Feature feature : featureCollection.getFeatures()) {
for (com.mapbox.geojson.Feature feature : featureCollection.features()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason this is using the full namespace here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Full namespace removed

positionList.add(singleLocationPosition);
for (Feature singleLocation : featureCollection.features()) {
Point singleLocationPoint = (Point) singleLocation.geometry();
pointList.add(singleLocationPoint);
Copy link
Contributor

Choose a reason for hiding this comment

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

You should add the item directly to the list rather than declaring a local variable and then passing it in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

}
}

private void initMatrixLocationListForRecyclerView() {
matrixLocationList = new ArrayList<>();
for (int x = 0; x < featureCollection.getFeatures().size(); x++) {
for (int x = 0; x < featureCollection.features().size(); x++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

foreach

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

.overview(DirectionsCriteria.OVERVIEW_FULL)
.profile(DirectionsCriteria.PROFILE_DRIVING)
.accessToken(Mapbox.getAccessToken())

Copy link
Contributor

Choose a reason for hiding this comment

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

remove extra space?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

mapboxMap.addOnCameraMoveListener(new MapboxMap.OnCameraMoveListener() {
@Override
public void onCameraMove() {
if (mapboxMap.getCameraPosition().zoom > 16) {
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

This turf exception can be removed, it's now runtime

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@@ -97,6 +101,7 @@ public void onCameraChange(CameraPosition position) {
hideLevelButton();
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@langsmith langsmith mentioned this pull request Mar 6, 2018
@langsmith langsmith merged commit 0a39320 into master Mar 6, 2018
@langsmith langsmith deleted the ls-multiple-version-bump-hotfixes branch March 6, 2018 23:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants