MapboxGL.setTelemetryEnabled(boolean) crashes on android
See original GitHub issueDescribe the bug
Calling MapboxGL.setTelemetryEnabled(boolean)
crashes on android.
To Reproduce
Call MapboxGL.setTelemetryEnabled(boolean)
in componentDidMount()
Example:
import React from 'react';
import MapboxGL from '@react-native-mapbox-gl/maps';
class BugReportExample extends React.Component {
componentDidMount() {
MapboxGL.setTelemetryEnabled(false);
}
render() {
return (
<MapboxGL.MapView style={{flex: 1}}>
</MapboxGL.MapView>
);
}
}
Expected behavior
Telemetry to be set to false and map to function
Actual behavior
iOS works fine.
On Android app crashes with following exception:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'void com.mapbox.mapboxsdk.maps.b0.setUserTelemetryRequestState(boolean)' on a null object reference
at com.mapbox.rctmgl.modules.RCTMGLModule$4.run(RCTMGLModule.java)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5421)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Screenshots
Versions (please complete the following information):
- Platform: Android
- Platform OS: Android 10 and 11
- Device: Samsung S20 and Google pixel emulator
- Emulator/ Simulator: Same error on both
- Dev OS: OSX 10.15.4
- react-native-mapbox-gl Version: 8.1.0
- React Native Version: 0.63.4
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Android 12 crash: MapboxGL.setTelemetryEnabled(boolean ...
Calling MapboxGL.setTelemetryEnabled(boolean) crashes on android. In logcat I can see that Telemetry is null and it reproduce even if I wait for map...
Read more >flutter 3 mapbox not working Targeting S+ (version 31 and ...
I know you might say this question was asked many times but all the answers did not help! I'm using MapBox in my...
Read more >ConnectivityReceiver (Mapbox Android Core SDK 3.1.0 ...
Get the connectivity state. static boolean, isConnected(Context context). Get the connectivity state as reported by the Android system.
Read more >Required diagnostic data for Office - Microsoft Learn
It collects the occurrence of Office Add-ins and documents crashes. This is only collected when user has enabled Office Telemetry Dashboard ...
Read more >@react-native-mapbox-gl/maps | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue seems to only occur in Android 12. Mapbox upgraded telemetry dependency to 8.1.0 to be compatible with Android 12 so I did the same.
https://github.com/mapbox/mapbox-gl-native-android/blob/main/CHANGELOG.md#962---july-7-2021
Adding this
implementation 'com.mapbox.mapboxsdk:mapbox-android-telemetry:8.1.0'
toandroid/app/build.gradle
fixed my problem.Hi,
I’ve experience same problem as @olofho just in Android 12. For me it work just fine in Android 10 & Android 11.
Versions (please complete the following information):
Platform: Android Platform OS: Android 12 Device: Android emulator & GooglePixel Emulator/ Simulator: Same error on both Dev OS: Windows 10 Pro react-native-mapbox-gl Version: 8.5.0 React Native Version: 0.63.4
Also as @airburst described moving
MapboxGL.setTelemetryEnabled(false)
toonDidFinishLoadingMap
,useEffect
orcomponentDidMount
doesn’t help. Telemetry object is always null and it causes application crash.Can we reopen this issue?