Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[Android] NullPointerException in ConnectivityReceiver => onConnectivityChanged #6838

Closed
K-Leon opened this issue Oct 27, 2016 · 14 comments · Fixed by #6858
Closed

[Android] NullPointerException in ConnectivityReceiver => onConnectivityChanged #6838

K-Leon opened this issue Oct 27, 2016 · 14 comments · Fixed by #6858
Assignees
Labels
Android Mapbox Maps SDK for Android crash

Comments

@K-Leon
Copy link

K-Leon commented Oct 27, 2016

Platform: Android
Mapbox SDK version: com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.1

Just got a crashreport in Crashlytics raising a Null Pointer Exception:

Image ( Looks better ):

image

It's on a Customer Device in Production - so i don't know how to reproduce, but maybe this helps.

Full Stacktrace:

Fatal Exception: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) } in com.mapbox.mapboxsdk.maps.MapView$ConnectivityReceiver@23951ec3 at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:876) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697) Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.mapbox.mapboxsdk.maps.NativeMapView.setReachability(boolean)' on a null object reference at com.mapbox.mapboxsdk.maps.MapView.onConnectivityChanged(MapView.java:2357) at com.mapbox.mapboxsdk.maps.MapView.access$3100(MapView.java:115) at com.mapbox.mapboxsdk.maps.MapView$ConnectivityReceiver.onReceive(MapView.java:2342) at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:866) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697)

@tobrun
Copy link
Member

tobrun commented Oct 31, 2016

Thank your for reporting, I think the use-case will be destroying the underlying map object and at the same time still receiving connectivity change events. Added a check to validate if the map isn't destroyed should resolve this.

@fab1an
Copy link

fab1an commented Dec 29, 2016

Is this bugfix already in a release? I searched the notes, but couldn't find anything.

@tobrun
Copy link
Member

tobrun commented Dec 29, 2016

This was released in 4.2.0 and 4.2.1

@fab1an
Copy link

fab1an commented Dec 30, 2016

Thank you, tobrun.

@fab1an
Copy link

fab1an commented Jan 11, 2017

@keenubee I don't think it was.

@tobrun Is there any way to work around this, this is the only thing crashing our production app :(.

@keenubee
Copy link

@fab1an I was tried to build a custom package with Jitpack but it's not compiles libmapbox-gl.so library (it is originally compiling with Bitrise as i know)

@insidelabs
Copy link

+1 - We're seeing a significant amount of crashes relating to this.

@K-Leon
Copy link
Author

K-Leon commented Jan 14, 2017

Is there an easy way to backport this to 4.1.1?
React Native Mapbox Gl won't work with 4.2 and nobody knows the reason so far.. sigfault.

@skeie
Copy link

skeie commented Jan 16, 2017

We also face this issue.

@tobrun
Copy link
Member

tobrun commented Jan 16, 2017

Thank you all for reaching out and requesting this fix, we are currently thinking about a 4.2.2 bugfix release that would include a fix for this issue. Will update the ticket if there is a concrete eta.

@fab1an
Copy link

fab1an commented Jan 16, 2017

@tobrun That sounds good. If the version still takes some time, however, do you think you could help us make a custom build ourselves?

@tobrun
Copy link
Member

tobrun commented Jan 16, 2017

@fab1an that is possible, though not advisable, to do this you need clone this repo, make sure your system can build this project, check out the release-android-v4.2.1 , cherry pick 8dbff2a and build the related aar files with make apackage

@tobrun
Copy link
Member

tobrun commented Jan 24, 2017

Update as we are planning a v4.2.2 release including this fix, release branch will release-android-v4.2.2

@tobrun tobrun reopened this Jan 24, 2017
@tobrun tobrun self-assigned this Jan 24, 2017
@tobrun tobrun added this to the android-v4.2.2 milestone Jan 24, 2017
@tobrun tobrun closed this as completed Jan 27, 2017
bsudekum pushed a commit to nitaliano/react-native-mapbox-gl that referenced this issue Feb 7, 2017
mattvot pushed a commit to calvium/react-native-mapbox-gl that referenced this issue Jun 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants