question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] Crash when opening a screen with map in Android 11

See original GitHub issue

Describe the bug
Every time I open a screen that has a map, the application crashes. It seems this has to do with the latest version of Android. Android 11. This crash did not occur before the last update of the operating system.

To Reproduce
Open a screen with a map.

Expected behavior
The screen should show the content (map).

Actual behavior
Crashes the app when we try to open a screen with a map.

Screenshots Screen Shot 2021-03-19 at 2 13 38 PM

Screenshot_20210319-140733_Vibemap

Versions (please complete the following information):

  • Platform: Android
  • Platform OS: Android 11
  • Device: Samsung Galaxy A51
  • Emulator/ Simulator: No
  • Dev OS: [e.g. OSX 11.0.1, Win10]
  • react-native-mapbox-gl Version 8.1.0
  • React Native Version: 0.63.4

Additional context
Logs:

Fatal Exception: java.lang.SecurityException: getDataNetworkTypeForSubscriber: uid 10306 does not have android.permission.READ_PHONE_STATE.
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2385)
       at android.os.Parcel.createException(Parcel.java:2369)
       at android.os.Parcel.readException(Parcel.java:2352)
       at android.os.Parcel.readException(Parcel.java:2294)
       at com.android.internal.telephony.ITelephony$Stub$Proxy.getNetworkTypeForSubscriber(ITelephony.java:8762)
       at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:3706)
       at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:3670)
       at com.mapbox.android.telemetry.m0.h(:10)
       at com.mapbox.mapboxsdk.module.telemetry.PhoneState.<init>(:21)
       at com.mapbox.mapboxsdk.module.telemetry.TelemetryImpl.onAppUserTurnstileEvent(:25)
       at com.mapbox.mapboxsdk.maps.m.a(:8)
       at com.mapbox.rctmgl.components.mapview.c.<init>(:45)
       at com.mapbox.rctmgl.components.mapview.b.<init>()
       at com.mapbox.rctmgl.components.mapview.RCTMGLAndroidTextureMapViewManager.createViewInstance(:11)
       at com.mapbox.rctmgl.components.mapview.RCTMGLAndroidTextureMapViewManager.createViewInstance()
       at com.facebook.react.uimanager.ViewManager.createViewInstance()
       at com.facebook.react.uimanager.ViewManager.createView()
       at com.facebook.react.uimanager.m.a(:34)
       at com.facebook.react.uimanager.v0$e.execute(:23)
       at com.facebook.react.uimanager.v0$a.run(:114)
       at com.facebook.react.uimanager.v0.j(:53)
       at com.facebook.react.uimanager.v0.j()
       at com.facebook.react.uimanager.v0$j.b(:31)
       at com.facebook.react.uimanager.e.a()
       at com.facebook.react.modules.core.g$d.a(:46)
       at com.facebook.react.modules.core.a$a$a.doFrame(:2)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1008)
       at android.view.Choreographer.doCallbacks(Choreographer.java:809)
       at android.view.Choreographer.doFrame(Choreographer.java:740)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:246)
       at android.app.ActivityThread.main(ActivityThread.java:8443)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

9reactions
skicsoncommented, Mar 23, 2021

This issue has to do with a deprecated Android call. It was fixed in mapbox several months ago but has not been updated in this library. A workaround is to add this line: implementation 'com.mapbox.mapboxsdk:mapbox-android-telemetry:6.1.0' to the @react-native-mapbox-gl/maps/android/rctmgl/build.gradle file under the implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0 line.

6reactions
siMs0ncommented, Sep 22, 2021

Hello @ferdicus. I’m using this package as a plugin in an Expo custom development client. It’s a convenient way of adding this great package without having to eject to the bare workflow. This means that Expo handles all Android and iOS code and I can’t access it. But this also means that I can’t implement your suggested solution. Would you reconsider upgrading the android SDK or adding the telemetry library to avoid crashing? I assume more people will start using it as a plugin and encounter this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Android] Crash when opening a screen with map in Android 11
Every time I open a screen that has a map, the application crashes. It seems this has to do with the latest version...
Read more >
How to fix Maps when it crashes - Android - Google Maps Help
On your Android phone or tablet, open the Settings app . Tap Apps & notifications. Follow the steps on your device to find...
Read more >
Top 8 Ways to Fix Google Maps Keeps Crashing on Android
1. Force Stop Google Maps · 2. Restart Your Device · 3. Check App Permissions · 4. Clear Cache and Data · 5....
Read more >
[Android] Crash when opening a screen with map in Android ...
Every time I open a screen that has a map, the application crashes. It seems this has to do with the latest version...
Read more >
Solved: How do I fix Google Maps Android App Crashes, Not ...
Step 1: Open the Google Maps app. ... Step 2: Tap on your profile icon located at the top-right corner. Step 3: Tap...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found