You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Updated descriptions of getting and using Android API Keys. It works differently than when this was originally written.
- Added fix for DexException
- Added "import" in map component code
Copy file name to clipboardExpand all lines: docs/installation.md
+36-33Lines changed: 36 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,20 @@ First, download the library from npm:
6
6
npm install react-native-maps --save
7
7
```
8
8
9
-
Then you must install the native dependencies: You can use `rnpm` (now part of `react-native` core) to
9
+
Second, install the native dependencies: You can use `rnpm` (now part of `react-native` core via `link`) to
10
10
add native dependencies automatically then continue the directions below depending on your target OS.
11
11
12
-
`$ react-native link`
12
+
```
13
+
react-native link
14
+
```
13
15
14
16
>This installation should work in physical devices. For Genymotion, be sure to check Android installation about Google Play Services
15
17
16
18
## iOS
17
19
18
20
### Option 1: CocoaPods - Same as the included AirMapsExplorer example
19
21
20
-
1. Setup your `Podfile` like the included [example/ios/Podfile](../example/ios/Podfile) then run `pod install`.
22
+
1. Setup your `Podfile` like the included [example/ios/Podfile](../example/ios/Podfile), replace all references to `AirMapExplorer` with your project name, and then run `pod install`.
21
23
(If you do not need `GoogleMaps` support for iOS, then you can probably completely skip this step.)
22
24
1. Open your project in Xcode workspace
23
25
1. Drag the following folder into your project:
@@ -44,6 +46,8 @@ Now if you need `GoogleMaps` support you will also have to add a bunch of other
44
46
After your `Podfile` is setup properly, run `pod install`.
45
47
46
48
### Option 3: Manually
49
+
>This was already done for you if you ran "react-native link"
50
+
47
51
1. Open your project in Xcode, right click on `Libraries` and click `Add
48
52
Files to "Your Project Name"` Look under `node_modules/react-native-maps/ios` and add `AIRMaps.xcodeproj`.
49
53
1. Add `libAIRMaps.a` to `Build Phases -> Link Binary With Libraries.
@@ -60,6 +64,8 @@ After your `Podfile` is setup properly, run `pod install`.
60
64
## Android
61
65
62
66
1. In your `android/app/build.gradle` add:
67
+
>This step is not necessary if you ran "react-native link"
68
+
63
69
```groovy
64
70
...
65
71
dependencies {
@@ -69,16 +75,18 @@ After your `Podfile` is setup properly, run `pod install`.
69
75
```
70
76
71
77
1. In your `android/settings.gradle` add:
78
+
>This step is not necessary if you ran "react-native link"
79
+
72
80
```groovy
73
81
...
74
82
include ':react-native-maps'
75
83
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/android')
76
84
```
77
85
78
86
1. Specify your Google Maps API Key:
79
-
> For development, it is recommended to use a ***Browser Key*** without referrer restrictions. Go to https://console.developers.google.com/apis/credentials to check your credentials.
87
+
> For development, you need to get a ***API Key***. Go to https://console.developers.google.com/apis/credentials to check your credentials.
80
88
81
-
Add your **Browser**API key to your manifest file (`android\app\src\main\AndroidManifest.xml`):
89
+
Add your API key to your manifest file (`android\app\src\main\AndroidManifest.xml`):
82
90
83
91
```xml
84
92
<application>
@@ -87,18 +95,6 @@ After your `Podfile` is setup properly, run `pod install`.
87
95
android:name="com.google.android.geo.API_KEY"
88
96
android:value="Your Google maps API Key Here"/>
89
97
</application>
90
-
```
91
-
> If that doesn't work, try using an ***Android Key*** without referrer restrictions. Go to https://console.developers.google.com/apis/credentials to check your credentials.
92
-
93
-
Add your **Android** API key to your manifest file:
94
-
95
-
```xml
96
-
<application>
97
-
<!-- You will only need to add this meta-data tag, but make sure it's a child of application -->
> Note: As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception.
1. Go to [Google API Console](https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend) and select your project, or create one.
184
-
In `Overview -> Google Maps API -> Google Maps Android API ` -> Check if it's enabled
185
-
Create a new key by clicking on `Create credentials -> API Key -> Android Key`, enter the name of the API key and your SHA1 key, generated before, and create it.
186
-
Check installation step 4.
187
-
188
-
1. Clean the cache :
189
-
`watchman watch-del-all`
190
-
`npm cache clean`
177
+
- Android 6.0 (API 23) / Google APIs Intel x86 Atom System Image Rev. 19
178
+
1. Check manual installation steps if you didn't run "react-native link"
179
+
1. Go to [Google API Console](https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend) and select your project, or create one.
180
+
Then, once enabled, select `Go to credentials`.
181
+
Select `Google Maps Android API` and create a new key.
182
+
Enter the name of the API key and create it.
183
+
184
+
1. Clean the cache :
185
+
```
186
+
watchman watch-del-all
187
+
npm cache clean
188
+
```
191
189
192
190
1. When starting emulator, make sure you have enabled `Wipe user data`.
193
191
194
192
1. Run `react-native run-android`
195
193
196
-
1. At this step it should work, but if not, go to your [Google API Console](https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&pli=1) and create a `Browser key` instead of a `Android key` and go to step 6.
194
+
1. If you encounter `com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim`, then clear build folder.
0 commit comments