Xwind
Xwind

Reputation: 101

Mapbox error [HTTP] Unable to parse resourceUrl

I'm trying to integrate map in my React Native app using Mapbox

I follow the instructions for Android: creating access token, trying all 3 implementations, but I keep getting this error

Mapbox error [HTTP] Unable to parse resourceUrl mapbox://styles/mapbox/streets-v11 {"level": "error", "message": "[HTTP] Unable to parse resourceUrl mapbox://styles/mapbox/streets-v11", "tag": "Mbgl-HttpRequest"}

And the map is completely black like this

Does anyone know what causes the problem and how to fix it?

Upvotes: 9

Views: 3349

Answers (2)

kanxxx
kanxxx

Reputation: 1

Awesome! Just tried @Exoriri suggestion it on my dev build and worked like a charm. I was also getting an empty black box but this line seemed to solve it, wonder why it wasn't detected in the app.config.js. So yeah cheers from the Turbo Mono expo repo managed with pnpm ;P

MapboxGL.setWellKnownTileServer('Mapbox');

Did the trick.

Upvotes: 0

Exoriri
Exoriri

Reputation: 435

I also had this issue. By exploring GitHub found a solution and finally made it work in my app. Before you define MapboxGL.setAccessToken, you need to put MapboxGL.setWellKnownTileServer('Mapbox'). Your code will look like:

MapboxGL.setWellKnownTileServer('Mapbox');
MapboxGL.setAccessToken("<YOUR_ACCESS_TOKEN>");

Here is a reference to this issue https://github.com/rnmapbox/maps/issues/1840

Upvotes: 13

Related Questions