chevron-up bell reply instagram twitter2 feed3 finder search-25px-p0

React Native Series – 0x00 Setting up Environment


Install React Native Android Running Environment (MacOS):

Step 1. Install the latest JDK from: Here

Step 2. Use brew cask install android-sdk to install Android SDK

Step 3. Add Android SDK to your environment by:
export ANDROID_HOME=/usr/local/share/android-sdk
Note: if you want to update the android sdk, use the sdkmanager --update

Step 4. Open a new terminal window and type android, in the following window make sure select:
* Android 6.0 (API 23)
* Android Support Repository intel x86 Emulator
* Android SDK build Tool 23.0.1

Step 5. Install the adb: brew cask install android-platform-tools
Step 6. Install the following tools:
* brew install watchman: watchman is a tool to monitor the file changes. With such a tool, we can have real-time reveal on devices or simulators.

  • brew install flow: flow is a static type checking tool for javascript, which helps to detect the possible errors in the code.

Some basic concepts:
JSX is a preprocessor step that adds XML syntax to JavaScript.

  • You can definitely use React without JSX but JSX makes React a lot more elegant. Just like XML, JSX tags have a tag name, attributes, and children.
  • JSX syntax can help you to run js and html together.

Some common error:

  1. Error "type error undefined is not a function evaluating bridge"

Solution: close the npm start terminal and restart react-native run-anroid

  1. When building app on Android, sometimes you will encounter such an error:

    JS server already running.
    Building and installing the app on the device (cd android && ./gradlew installDebug)...
    Could not install the app on the device, read the error above for details.
    Make sure you have an Android emulator running or a device connected and have
    set up your Android development environment:

Solution: check the permission on gradle under android. It should be 755 not 644.



Make Your Comments