Merge pull request #4575 from satya164/docsfix

Improve docs for Building from source
This commit is contained in:
James Ide 2015-12-04 21:22:03 -08:00
commit 4c531d220a
1 changed files with 19 additions and 5 deletions

View File

@ -37,7 +37,9 @@ ndk.dir=/Users/your_unix_name/android-ndk/android-ndk-r10e
## Building the source
1. Install `react-native` from your fork. For example, to install the master branch from the offcial repo, run the following:
#### 1. Installing the fork
First, you need to install `react-native` from your fork. For example, to install the master branch from the official repo, run the following:
```sh
npm install --save github:facebook/react-native#master
@ -45,7 +47,10 @@ npm install --save github:facebook/react-native#master
Alternatively, you can clone the repo to your `node_modules` directory and run `npm install` inside the cloned repo.
2. Add `gradle-download-task` as dependency in `android/build.gradle`:
#### 2. Adding missing dependencies
Add `gradle-download-task` as dependency in `android/build.gradle`:
```gradle
...
@ -59,7 +64,10 @@ Alternatively, you can clone the repo to your `node_modules` directory and run `
...
```
3. Add the `:ReactAndroid` project in `android/settings.gradle`:
#### 3. Adding the `:ReactAndroid` project
Add the `:ReactAndroid` project in `android/settings.gradle`:
```gradle
...
@ -69,7 +77,8 @@ project(':ReactAndroid').projectDir = new File(rootProject.projectDir, '../node_
...
```
4. Modify your `android/app/build.gradle` to use the `:ReactAndroid` project instead of the pre-compiled library, e.g. - replace `compile 'com.facebook.react:react-native:0.16.+'` with `compile project(':ReactAndroid')`:
Modify your `android/app/build.gradle` to use the `:ReactAndroid` project instead of the pre-compiled library, e.g. - replace `compile 'com.facebook.react:react-native:0.16.+'` with `compile project(':ReactAndroid')`:
```gradle
...
@ -84,7 +93,12 @@ dependencies {
...
```
5. If you use 3rd-party React Native modules, modify your `android/app/build.gradle` to override their dependencies so that they don't bundle the pre-compiled library, e.g. - replace `compile project(':react-native-custom-module')` with:
#### 4. Making 3rd-party modules use your fork
If you use 3rd-party React Native modules, you need to override their dependencies so that they don't bundle the pre-compiled library. Otherwise you'll get an error while compiling - `Error: more than one library with package name 'com.facebook.react'`.
Modify your `android/app/build.gradle` and replace `compile project(':react-native-custom-module')` with:
```gradle
compile(project(':react-native-custom-module')) {