react-native-maps: Map can not show on Android
I followed the Installation Guide, did link by using rnpm link and tried to search error log below to check if ‘rnpm link’ can link correctly following by the Installation Guide, that is correct and it works on iOS. But it doesn’t work on Android.


React Native Version
Sippakorns-MacBook-Air:TestMap spksoft$ react-native -v
react-native-cli: 1.0.0
react-native: 0.34.1
Android Log : react-native android-log
10-12 07:12:56.286 5967 6731 I ReactNativeJS: undefined
10-12 07:13:02.608 5967 6738 W ReactNativeJS: Warning: Native component for "AIRMapUrlTile" does not exist
10-12 07:13:02.611 5967 6738 W ReactNativeJS: Warning: Native component for "AIRMap" does not exist
10-12 07:13:02.650 5967 6738 I ReactNativeJS: Running application "TestMap" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
index.android.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import MapView from 'react-native-maps';
class TestMap extends Component {
render() {
const { region } = this.props;
console.log(region);
return (
<View style ={styles.container}>
<MapView
style={styles.map}
region={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.015,
longitudeDelta: 0.0121,
}}
>
</MapView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
height: 400,
width: 400,
justifyContent: 'flex-end',
alignItems: 'center',
},
map: {
...StyleSheet.absoluteFillObject,
},
});
AppRegistry.registerComponent('TestMap', () => TestMap);
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 7
- Comments: 17 (1 by maintainers)
Commits related to this issue
- Update installation.md Fix issue #684 (blank white map) — committed to nicovak/react-native-maps by nicovak 8 years ago
I finally solved the problem by adding
import com.airbnb.android.react.maps.MapsPackage;andnew MapsPackage()in
So the completely code is below
I had same problem before and I resolved it by changing the styles to the following.
Also, if you see Google logo in the bottom and the map is blank, then your API key is wrong.
From the beginning this is what I did:
Create project
react-native init MAPIn android/app/src/main/AndroidManifest.xml add a new
meta-datachild to theapplicationtag:Enable your API for Android or IOs: https://console.cloud.google.com/apis/api/maps_android_backend/overview?project=sage-etching-147318&duration=PT1H
Install and Link the package:
npm i react-native-maps --savereact-native linkAdd the MapView in index.android.js:
npm start --clear-cachereact-native run-androidIn Case Of Error
cd androidgradlew cleancd ..react-native run-androidIt works for me, I hope it helps someone in the future.
I I’m having this problem in Android only in release Bundle.
*My map shows all white, with no Google logo in bottom left corner. *In dev the same map shows correctly.
#import <React/RCTBundleURLProvider.h> in AppDelegate.m in Xcode, give this error ‘React/RCTBundleURLProvider.h’ file not found.
I have fixed by install react native link and install google play service in my android studio