Expo custom dev client permission issues with react-native-mapbox-gl

I’m trying to use a custom dev client to try out react-native-mapbox-gl. I have added the @react-native-mapbox-gl/maps plugin to my app.json and also the necessary android permissions ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION.
But still when I’m trying to display the map I get the following error

locationManager Error:  [Error: uid 10154 does not have android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION.]

This is pretty weird because I’m adding these permission inside my app.json but they don’t get applied.

This is an excerpt from my app.json:

"android": {
  "adaptiveIcon": {
    "foregroundImage": "./assets/adaptive-icon.png",
    "backgroundColor": "#FFFFFF"
  },
  "permissions": [
    "ACCESS_COARSE_LOCATION",
    "ACCESS_FINE_LOCATION",
    "CAMERA_ROLL",
    "CAMERA"
  ],
  "package": "com.jonashiltl.customdevclient"
},
"web": {
  "favicon": "./assets/favicon.png"
},
"plugins": ["@react-native-mapbox-gl/maps"]

run expo prebuild -p android and look at the androidmanifest to verify that the permissions are added

Both permissions are added

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

looks to be properly configured on the expo side then. did you do a new build on eas build after adding those permissions?

I’m running expo run:android to run the app locally on an emulator.
I have created a Repo with my current environment that throws this permission error. It also includes a test token from mapbox so you don’t have to create an account yourself.

1 Like

The permissions error only occurs when I add <MapboxGL.UserLocation />. So I’m able to display the map but when needing the user location for the marker, I get the already stated permissions error

i won’t have a chance to look at this probably until friday, but some things you could try:

  • run expo prebuild -p android --clean to re-generate from scratch before expo run:android
  • install expo-location, run the above commands again. does that help?
  • if not, try requesting runtime permissions in expo-location - does tha thelp?

based on what i can see here so far this seems to be an issue with the mapbox-gl library, since we’re adding the permissions to the correct place.