Skip to content

Instantly share code, notes, and snippets.

@ccfiel
Last active June 13, 2018 00:13
Show Gist options
  • Save ccfiel/bd5535743604c07ae1b29a6206aeb481 to your computer and use it in GitHub Desktop.
Save ccfiel/bd5535743604c07ae1b29a6206aeb481 to your computer and use it in GitHub Desktop.
Installing React-Native on Ubuntu

First, you'll need NodeJS and NPM:

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
nodejs -v
v8.4.0

Install development tools to build native addons:

sudo apt-get install gcc g++ make

Install the Yarn package manager, run:

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

Then you can install react-native using npm

sudo npm install -g react-native-cli

Now you need to install Java/ Android

sudo apt-get install default-jre
sudo apt-get install default-jdk

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
  • Install Android
  • Install Android SDK requirements
cd ~
mkdir android-sdk
cd android-sdk
wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
sudo apt-get install unzip
unzip sdk-tools-linux-3859397.zip

We add the path of our Android SDK tools to .bashrc so that we have access to the Android tools.

cd ~
nano .bashrc

# Add these lines to the top of the file
export ANDROID_HOME=$HOME/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

# CTRL+O (uppcase o) to save
# CTRL+X to exit

source ~/.bashrc

Now we have access to the android command


android update sdk --no-ui
# Answer 'y' to all prompts

sdkmanager "platforms;android-23" "build-tools;23.0.1" "add-ons;addon-google_apis-google-23"

Installing tailpos mobile app

cd ~
mkdir Projects
cd Projects
git clone https://gitlab.com/bailabs/tailpos-mobile.git
cd tailpos-mobile
yarn

Updating react-native-camera modules

  • remove buildscript section
buildscript {
repositories {
  jcenter()
  maven {
    url 'https://maven.google.com'
  }
}

dependencies {
  classpath 'com.android.tools.build:gradle:3.0.0'
}
}

  • compileOnly to provided
  • implemenation to compile
cd ~
nano Projects/tailpos-mobile/node_modules/react-native-camera/android/build.gradle

Updating react-native-maps modules

  • compileOnly to provided
  • implemenation to compile
cd ~
nano Projects/tailpos-mobile/node_modules/react-native-maps/lib/android/build.gradle

Updating react-native-bluetooth-serial modules

  • remove @Override in line 23 (the second @Override)
cd ~
nano Projects/tailpos-mobile/node_modules/react-native-bluetooth-serial/android/src/main/java/com/rusel/RCTBluetoothSerial/RCTBluetoothSerialPackage.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment