Instantly share code, notes, and snippets.

@peterp /README.md
Last active Oct 4, 2018

Embed
What would you like to do?
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

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
https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
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 ~
pico .bashrc

# Add these lines to the top of the file
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/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"
  • TODO: Install GenyMotion
  • TODO: Get a project running

Create your first project!

mkdir projects
cd projects
react-native init my-first-project
cd my-first-project
@kevinsmithwebdev

This comment has been minimized.

Show comment
Hide comment
@kevinsmithwebdev

kevinsmithwebdev May 17, 2018

Thank you, this helped me. My only comments are:

The instruction:

https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip

This of course isn't a linux command (afaik). But downloading it and putting it in that directory worked.

Also, I didn't have a path to sdkmanager and had to find it and explicitly state a path. Maybe I'd missed something else earlier.

But this did get Java off my system, get the correct one installed and things are working now.

Thanks!

kevinsmithwebdev commented May 17, 2018

Thank you, this helped me. My only comments are:

The instruction:

https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip

This of course isn't a linux command (afaik). But downloading it and putting it in that directory worked.

Also, I didn't have a path to sdkmanager and had to find it and explicitly state a path. Maybe I'd missed something else earlier.

But this did get Java off my system, get the correct one installed and things are working now.

Thanks!

@CyberArrow

This comment has been minimized.

Show comment
Hide comment
@CyberArrow

CyberArrow May 29, 2018

The command I used was: wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip. Downloading was okay, but I think that was the command you were looking for.

CyberArrow commented May 29, 2018

The command I used was: wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip. Downloading was okay, but I think that was the command you were looking for.

@miguelzau

This comment has been minimized.

Show comment
Hide comment
@miguelzau

miguelzau May 31, 2018

Hi, thanks for the tutorial, but i having this problem when using the android update sdk --no-ui:
Warning: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Warning: Failed to download any source lists!
Warning: File /home/miguel/.android/repositories.cfg could not be loaded.

Anyone can help me?

Using Ubuntu 18.04

Solved, i use this link: https://www.filebot.net/forums/viewtopic.php?t=5929

miguelzau commented May 31, 2018

Hi, thanks for the tutorial, but i having this problem when using the android update sdk --no-ui:
Warning: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Warning: Failed to download any source lists!
Warning: File /home/miguel/.android/repositories.cfg could not be loaded.

Anyone can help me?

Using Ubuntu 18.04

Solved, i use this link: https://www.filebot.net/forums/viewtopic.php?t=5929

@iozeen

This comment has been minimized.

Show comment
Hide comment
@iozeen

iozeen Aug 5, 2018

For those wondering how to call: sdkmanager "platforms;android-23" "build-tools;23.0.1" "add-ons;addon-google_apis-google-23"
You should go to android_sdk/tools/bin and call it like this: ./sdkmanager "platforms;android-23" "build-tools;23.0.1" "add-ons;addon-google_apis-google-23"

iozeen commented Aug 5, 2018

For those wondering how to call: sdkmanager "platforms;android-23" "build-tools;23.0.1" "add-ons;addon-google_apis-google-23"
You should go to android_sdk/tools/bin and call it like this: ./sdkmanager "platforms;android-23" "build-tools;23.0.1" "add-ons;addon-google_apis-google-23"

@SakhirAtwi

This comment has been minimized.

Show comment
Hide comment
@SakhirAtwi

SakhirAtwi Aug 10, 2018

For anyone looking for a step further to create an Andriod Virtual Device, use

avdmanager create avd -n app-emu -k "system-images;android-23;google_apis;x86"

and then run the emulator by:

emulator @app-emu

Side-Note: If you are stuck at sdkmanager --update or android update sdk --no-ui then just be patience, it is going to take 5 minutes min.

Cheers, Happy Coding.

-SakhirAtwi.

SakhirAtwi commented Aug 10, 2018

For anyone looking for a step further to create an Andriod Virtual Device, use

avdmanager create avd -n app-emu -k "system-images;android-23;google_apis;x86"

and then run the emulator by:

emulator @app-emu

Side-Note: If you are stuck at sdkmanager --update or android update sdk --no-ui then just be patience, it is going to take 5 minutes min.

Cheers, Happy Coding.

-SakhirAtwi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment