Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native-maps blank on android device

React native is blank on my android device. It's just a grey screen with the google logo. Unlike React-native-maps Blank page Only google logo it is is working on a simulator but not on real device.

I searched for the problem online:

  • The API should be fine
  • stylesheet is ok
  • it's working on genymotion emulator
  • working on android virtual device

    Perfectly working on Expo but not when I download the app from playstore. The meta-data in AndroidManifest.xml looks like this:

    This is how the mapView looks like:

     ` <MapView
              showsUserLocation={false}
              style={styles.map}
              provider='google'
              ref={ref => { map3 = ref; }}
              onMapReady = { this.onMapReady }
              initialRegion={this.state.region}
              >
                <Marker 
                image={logo}
                coordinate={this.state.coordinate}
                />
    </MapView>`
    

.. and the style:

    `const styles = StyleSheet.create({
      mapContainer: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: '#ecf0f1',
      },
      map: {
        flex: 1,
        borderRadius: 4,
        width,
        height,
        zIndex: 1,
      },`
like image 620
user9468014 Avatar asked Jul 17 '18 09:07

user9468014


1 Answers

If all else fails, like was in my case, don't forget the basic stuff. Turns out I hadn't enabled 'Maps SDK for Android' in the console.developers.google.com

like image 97
Mwaniki Sam Avatar answered Sep 22 '22 09:09

Mwaniki Sam