From b89e14ab95098fb13d87fa69e16576ce104f8ac6 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Sat, 5 Dec 2015 10:46:08 +0530 Subject: [PATCH] Improve docs for Building from source --- docs/AndroidBuildingFromSource.md | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/docs/AndroidBuildingFromSource.md b/docs/AndroidBuildingFromSource.md index b0fd0896a..b09c53811 100644 --- a/docs/AndroidBuildingFromSource.md +++ b/docs/AndroidBuildingFromSource.md @@ -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')) {