I’m having trouble with MapView’s on Android. I have a completely fresh brand new create-react-native-app setup. I change my App.js
to look like this:
import React from 'react';
import { StyleSheet, Dimensions } from 'react-native';
import { MapView } from 'expo';
const screen = Dimensions.get('window');
const ASPECT_RATIO = screen.width / screen.height;
const LATITUDE = 37.78825;
const LONGITUDE = -122.4324;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
export default class App extends React.Component {
constructor(props) {
super(props);
props.initialRegion = {
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
};
}
render() {
return (
<MapView
style={styles.map}
region={this.props.initialRegion}
></MapView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'column'
},
map: {
backgroundColor: 'transparent',
flex: 1,
width: '100%'
},
});
I run this in the emulator and everything looks good, I get a fresh map. I accurately follow the instructions listed here and get a final .apk build (using exp build:android
) and I install the .apk using adb install
onto my emulator, and the maps view is not working. I see the google icon in the corner, and adb logcat
shows some kind of authentication error.
I have followed the instructions perfectly, and have replicated this situation a handful of times now. This must be some kind of issue with expo or its cloud building or something.
I have also tried ejecting the application with expo sdk, but when I open and run the project in android studio, I get a blue screen saying that expo wasn’t set up correctly.