react-native-mapbox-gl icon indicating copy to clipboard operation
react-native-mapbox-gl copied to clipboard

[Android] Http code 401, loading style failed

Open jawwad22 opened this issue 4 years ago • 1 comments

Hi, Done everything according to this https://github.com/react-native-mapbox-gl/maps/blob/master/docs/GettingStarted.md

simply trying to run a but getting this error

my code import React, { Component } from "react"; import { StyleSheet, View } from "react-native"; import MapboxGL from "@react-native-mapbox-gl/maps";

MapboxGL.setAccessToken(sk.eyJ1IjoidGVzdG1hcGJveDIyIiwiYSI6ImNrYmtjaXY5MTB4aW4ycmxzZWp2cG0wa2YifQ.vZizWDkI67FBUFQSHCinmA );

const styles = StyleSheet.create({ page: { flex: 1, justifyContent: "center", alignItems: "center", backgroundColor: "#F5FCFF" }, container: { height: 300, width: 300, backgroundColor: "tomato" }, map: { flex: 1 } });

export default class App extends Component { componentDidMount() { MapboxGL.setTelemetryEnabled(false); }

render() { return ( <View style={styles.page}> <View style={styles.container}> <MapboxGL.MapView style={styles.map} /> </View> </View> ); } }

jawwad22 avatar Jun 18 '20 05:06 jawwad22

Hey I think you need a public access token, starts with pk to use with setAccessToken.

What you had there seems to be a secret token, sk.... That's probably needs to go to your gradle.properties file in inside android folder so that the android side can download maps.

When I set it up I needed to go through the steps for android here. https://github.com/react-native-mapbox-gl/maps/blob/master/android/install.md

thangpham7793 avatar Sep 07 '21 21:09 thangpham7793