在我的Android设备上,React native是空白的。它只是一个带有谷歌徽标的灰色屏幕。与React-native-maps Blank page Only google logo不同,它是在模拟器上工作,但不在真实设备上。
我在网上搜索了这个问题:
` <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 Play的应用签名服务。问题是expo应用程序和独立应用程序之间存在不同的哈希值。
转到Play控制台 - >您的应用程序 - >发布管理 - >应用程序签名,然后转到API Dashboard - >凭据并将签名添加到现有凭据。
如果所有其他方法都失败了,就像在我的情况下一样,不要忘记基本的东西。事实证明我没有在console.developers.google.com中启用“Maps SDK for Android”
可能的方法:
转到谷歌控制台 - > api和服务 - >面板 - >启用api和服务 - >选择谷歌地图