Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in cluster plugin #163

Closed
LouisCAD opened this issue Nov 10, 2017 · 11 comments
Closed

Crash in cluster plugin #163

LouisCAD opened this issue Nov 10, 2017 · 11 comments

Comments

@LouisCAD
Copy link

Hi,

I replaced Google Maps SDK with MapBox in an app where I was using cluster. I also replaced usages to Google Maps cluster util with the one from MapBox, fixed all the errors.

It worked flawlessly at first, but then, I got a crash while my app was adding more markers to cluster.

Here's the stacktrace of the error:

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
                                                                                                at com.mapbox.mapboxsdk.maps.IconManager.iconCleanup(IconManager.java:146)
                                                                                                at com.mapbox.mapboxsdk.maps.AnnotationManager.removeAnnotation(AnnotationManager.java:122)
                                                                                                at com.mapbox.mapboxsdk.maps.MapboxMap.removeAnnotation(MapboxMap.java:1428)
                                                                                                at com.mapbox.mapboxsdk.annotations.Annotation.remove(Annotation.java:53)
                                                                                                at com.mapbox.mapboxsdk.plugins.cluster.MarkerManager$Collection.remove(MarkerManager.java:122)
                                                                                                at com.mapbox.mapboxsdk.plugins.cluster.MarkerManager.remove(MarkerManager.java:99)
                                                                                                at com.mapbox.mapboxsdk.plugins.cluster.clustering.view.DefaultClusterRenderer$AnimationTask.onAnimationEnd(DefaultClusterRenderer.java:938)
                                                                                                at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1149)
                                                                                                at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1309)
                                                                                                at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
                                                                                                at android.animation.AnimationHandler.-wrap2(AnimationHandler.java)
                                                                                                at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
                                                                                                at android.view.Choreographer$CallbackRecord.run(Choreographer.java:957)
                                                                                                at android.view.Choreographer.doCallbacks(Choreographer.java:734)
                                                                                                at android.view.Choreographer.doFrame(Choreographer.java:667)
                                                                                                at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:945)
                                                                                                at android.os.Handler.handleCallback(Handler.java:751)
                                                                                                at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                                at android.os.Looper.loop(Looper.java:154)
                                                                                                at android.app.ActivityThread.main(ActivityThread.java:6776)
                                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
                                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)

Below is what was logged just before the crash:

11-10 08:59:01.981 20690-20690/com.example.packagenameofmyapp D/ClusterManagerPlugin: OnCamerIdle
11-10 08:59:01.981 20690-20690/com.example.packagenameofmyapp E/ClusterManagerPlugin: OnCluster
11-10 08:59:02.026 20690-21376/com.example.packagenameofmyapp V/HTTPRequest: [HTTP] Request was successful (code = 200).
11-10 08:59:02.048 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.69337, altitude=0.0]]]
11-10 08:59:02.051 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.69337, altitude=0.0]]]
11-10 08:59:02.071 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.693369999999998, altitude=0.0]]]
11-10 08:59:02.087 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999963, altitude=0.0]]]
11-10 08:59:02.102 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999945, altitude=0.0]]]
11-10 08:59:02.130 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999929, altitude=0.0]]]
11-10 08:59:02.145 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999914, altitude=0.0]]]
11-10 08:59:02.163 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999899, altitude=0.0]]]
11-10 08:59:02.170 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999887, altitude=0.0]]]
11-10 08:59:02.186 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999875, altitude=0.0]]]
11-10 08:59:02.204 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999864, altitude=0.0]]]
11-10 08:59:02.221 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999855, altitude=0.0]]]
11-10 08:59:02.238 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999846, altitude=0.0]]]
11-10 08:59:02.255 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999839, altitude=0.0]]]
11-10 08:59:02.271 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999834, altitude=0.0]]]
11-10 08:59:02.289 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999828, altitude=0.0]]]
11-10 08:59:02.305 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999825, altitude=0.0]]]
11-10 08:59:02.322 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999823, altitude=0.0]]]
11-10 08:59:02.339 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999821, altitude=0.0]]]
11-10 08:59:02.355 20690-20690/com.example.packagenameofmyapp W/AnnotationManager: Attempting to update non-added com.mapbox.mapboxsdk.annotations.Marker with value Marker [position[LatLng [latitude=47.41975, longitude=0.6933699999999821, altitude=0.0]]]
@langsmith
Copy link
Contributor

cc @tobrun

@tobrun
Copy link
Member

tobrun commented Nov 10, 2017

fixed upstream with mapbox/mapbox-gl-native#10388.

@tobrun tobrun closed this as completed Nov 10, 2017
@LouisCAD
Copy link
Author

@tobrun Why did you close the issue without giving any way to get the fix? I mean, there's no new version yet, right?

@tobrun
Copy link
Member

tobrun commented Nov 10, 2017

you can use 5.2.0-SNAPSHOT to test, will be shipped with beta.5 next week and aiming for a final release week after.

@LouisCAD
Copy link
Author

Thanks @tobrun
Worth noting you need to add the following repo for the snapshot in the build.gradle file:

repositories {
    maven {
        url = 'https://oss.sonatype.org/content/repositories/snapshots'
    }
}

@GitGadom
Copy link

GitGadom commented Nov 27, 2017

Hi,
the problem is back.

Used version: com.mapbox.mapboxsdk:mapbox-android-navigation:0.7.1-SNAPSHOT

Error:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
       at com.mapbox.mapboxsdk.maps.IconManager.iconCleanup(IconManager.java:146)
       at com.mapbox.mapboxsdk.maps.AnnotationManager.removeAnnotation(AnnotationManager.java:122)
       at com.mapbox.mapboxsdk.maps.MapboxMap.removeMarker(MapboxMap.java:1395)

Please fix it because as a consequence - my app is frozen.

@tobrun Could you help me?

/// EDIT
There is also something new.
Error 2:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.mapbox.services.android.navigation.v5.routeprogress.MetricsRouteProgress.getDirectionsRouteProfile()' on a null object reference
       at com.mapbox.services.android.navigation.v5.navigation.NavigationMetricsWrapper.cancelEvent(NavigationMetricsWrapper.java:64)
       at com.mapbox.services.android.navigation.v5.navigation.NavigationTelemetry.endSession(NavigationTelemetry.java:161)
       at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation.endNavigation(MapboxNavigation.java:394)
       at pl.krmob.carsbook.openStreetMaps.mapbox.MapBoxNavigationActivity.onResponse(MapBoxNavigationActivity.java:783)
       at pl.krmob.carsbook.openStreetMaps.mapbox.MapBoxNavigationActivity.access$800(MapBoxNavigationActivity.java:98)
       at pl.krmob.carsbook.openStreetMaps.mapbox.MapBoxNavigationActivity$12.onResponse(MapBoxNavigationActivity.java:1227)
       at com.mapbox.directions.v5.MapboxDirections$1.onResponse(MapboxDirections.java:169)
       at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6165)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)

Best regards

@LouisCAD
Copy link
Author

IMHO, if NPEs are your problem, then you should move to Kotlin instead of sticking to unsafe Java, so the compiler or the !! tell you where are the potential errors

@GitGadom
Copy link

The whole app is written in Java. Moving it to Kotlin would make a big mess right now. The main problem is definitely in the Mapbox library.

@LouisCAD
Copy link
Author

@GitGadom That's not so true since Kotlin allows smooth interop with Java, and the IDE allows to convert files one at a time, while keeping the project working

@GitGadom
Copy link

Ok, thank you for your response but still waiting for the developer comment.

@tobrun Could you look at these problems crashing my app?

@langsmith
Copy link
Contributor

@GitGadom , what version of the maps sdk are you using? For the navigation sdk, are you still using com.mapbox.mapboxsdk:mapbox-android-navigation:0.7.1-SNAPSHOT? Any code snippets you're able/willing to share with us to see what might be going on?

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

No branches or pull requests

4 participants