反应原生谷歌地图不显示在Android设备中

时间:2017-12-11 08:51:10

标签: android google-maps react-native

我想在我的react-native应用程序中集成google map,所以下面是我的代码

import React, { Component } from 'react';
import { AppRegistry, StyleSheet, View, Dimensions } from 'react-native';
import MapView  from 'react-native-maps';
export default class App extends Component<{}> {
  render() {
return (
  <MapView
  style={styles.container}
  region={{
  latitude: 37.78825,
  longitude: -122.4324,
  latitudeDelta: 0.015,
  longitudeDelta: 0.0121,
  }}
     >
  /MapView>
   }
  );
 }
}

const styles = StyleSheet.create({
container: {
height: '100%',
width: '100%',
 }
});

当我运行上面的代码时,我得到输出为空白页面,如下所示

enter image description here

任何想法我该如何解决这个问题?你的所有建议都很明显

1 个答案:

答案 0 :(得分:1)

据我所知,您错过了在应用根目录中包含google_services.json。当您从Google Play开发者控制台启用Google Maps API时,您会收到此消息。或者缺少API的正确API密钥。