How to Build React-Native environment

We get a new topic today, that is to build a native mobile app using javascript. Two frameworks are recommended: React Native / Native Script. Cause I have do some research on react, I choose react native to build an android application.

It takes 3 hours to get the environment ready, all the steps and focal points are listed here.

Step 1 : Install basic environment

1. Git

2.  Java JDK

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

3. Android SDK

https://developer.android.com/sdk/installing/index.html

Step 2 : Define Environment Variables

1 JAVA_HOME

JAVA_HOME:  C:\Program Files\Java\jdk1.8.0_77                   (JDK Path)
PATH: %JAVA_HOME%/bin;%JAVA_HOME%/jre/bin;

tips: remember to use ‘java -version’ and ‘java’ to test whether java environment is ok.

2 ANDROID_HOME

ANDROID_HOME : C:\Users\Cyrus_Cai\AppData\Local\Android\sdk      (Android SDK path)

PATH: %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;

Step 3 : Configure SDK

  1. Find Android manager ( Android SDK path)
  2. Make sure that the listed items are selected:
    • Android SDK Build-tools version 23.0.1
    • Android 6.0 (API 23)
    • Local Maven repository for Support Libraries (this is called Android Support Repository in older versions)

AndroidSDK1.pngAndroidSDK2.png

Step 4 : Install Genymotion

Genymotion: an emulators which is easier to set up than stock. More research is needed on  Genymotion actually.

We can get Genymotion here

Remember:

1. down individual version( it’s free)

2. VirtualBox is needed to set up Genymotion, if we haven’t installed it, we can download a with virtualBox version.

2016-05-06_011110.jpg

3. After installing Genymotion and virtualBox, remember to add a new virtual device and try to run it. This will help us to test whether android platform is ready or not (I guess).

2016-05-06_011448.jpg

Step 5 : Use gradle deamon

React Native Android use gradle as a build system. It is recommend to enable gradle daemon functionality which may result in up to 50% improvement in incremental build times for changes in java code.

site :https://docs.gradle.org/

how to : copy this command and run it in ‘command line’

(if not exist “%USERPROFILE%/.gradle” mkdir “%USERPROFILE%/.gradle”) && (echo org.gradle.daemon=true >> “%USERPROFILE%/.gradle/gradle.properties”)

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s