在Android设备上的react-native-maps空白

问题描述 投票:1回答:3

在我的Android设备上,React native是空白的。它只是一个带有谷歌徽标的灰色屏幕。与React-native-maps Blank page Only google logo不同,它是在模拟器上工作,但不在真实设备上。

我在网上搜索了这个问题:

  • API应该没问题
  • 样式表没关系
  • 它正在genymotion模拟器上工作
  • 在android虚拟设备上工作 完全从事世博会,但不是从Playstore下载应用程序。 AndroidManifest.xml中的元数据如下所示: 这就是mapView的样子: ` <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>`

..和风格:

    `const styles = StyleSheet.create({
      mapContainer: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: '#ecf0f1',
      },
      map: {
        flex: 1,
        borderRadius: 4,
        width,
        height,
        zIndex: 1,
      },`
google-maps react-native react-native-maps
3个回答
2
投票

我认为您已启用Google Play的应用签名服务。问题是expo应用程序和独立应用程序之间存在不同的哈希值。

转到Play控制台 - >您的应用程序 - >发布管理 - >应用程序签名,然后转到API Dashboard - >凭据并将签名添加到现有凭据。


2
投票

如果所有其他方法都失败了,就像在我的情况下一样,不要忘记基本的东西。事实证明我没有在console.developers.google.com中启用“Maps SDK for Android”


0
投票

可能的方法:

  • 确保已启用“Google Maps Android API v2”。

转到谷歌控制台 - > api和服务 - >面板 - >启用api和服务 - >选择谷歌地图

© www.soinside.com 2019 - 2025. All rights reserved.