Adding Android instructions to get started

This commit is contained in:
Fabrice Armisen 2016-01-24 19:36:29 -08:00
parent 7fe585bdb2
commit c8966280b1
1 changed files with 28 additions and 0 deletions

View File

@ -10,7 +10,13 @@ Below is a list of known issues. Pull requests are welcome for any of these issu
- Stills captured to disk will not be cleaned up and thus must be managed manually for now
## Getting started
### Mostly automatic install
1. `npm install rnpm --global`
2. `npm install react-native-camera@latest --save`
3. `rnpm link react-native-camera`
### Manual install
#### iOS
1. `npm install react-native-camera@latest --save`
2. In XCode, in the project navigator, right click `Libraries``Add Files to [your project's name]`
3. Go to `node_modules``react-native-camera` and add `RCTCamera.xcodeproj`
@ -18,6 +24,28 @@ Below is a list of known issues. Pull requests are welcome for any of these issu
5. Click `RCTCamera.xcodeproj` in the project navigator and go the `Build Settings` tab. Make sure 'All' is toggled on (instead of 'Basic'). In the `Search Paths` section, look for `Header Search Paths` and make sure it contains both `$(SRCROOT)/../../react-native/React` and `$(SRCROOT)/../../../React` - mark both as `recursive`.
5. Run your project (`Cmd+R`)
#### Android
1. `npm install react-native-camera@latest --save`
2. Modify the ReactInstanceManager.builder() calls chain in `android/app/main/java/.../MainActivity.java` to include:
```
.addPackage(new RCTCameraPackage())
```
3. Append the following lines to `android/settings.gradle`:
```
include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
```
4. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-camera')
```
## Usage
All you need is to `require` the `react-native-camera` module and then use the