Skip to content

Instantly share code, notes, and snippets.

@bdmayes
Last active October 16, 2019 13:52
Show Gist options
  • Save bdmayes/9ef552993772044cc19c072c215a5036 to your computer and use it in GitHub Desktop.
Save bdmayes/9ef552993772044cc19c072c215a5036 to your computer and use it in GitHub Desktop.
# Linux:
## Download Android studio
1. Download from https://developer.android.com/studio/ and extract it with `tar -xzf`. This should create an `android-studio` directory.
2. `cd` into `android-studio` and run `bin/studio.sh`
3. Download all the things, including using SDK manager to get the latest platform _and_ tools (see https://developer.android.com/studio/intro/update.html#sdk-manager).
4. It will probably complain about performance and suggest you increase the heap size and relaunch. You should do this.
5. Go to File > Project Structure > SDK Location and copy the value. Export this as ANDROID_SDK_ROOT in your .bashrc (or .zshrc, etc.).
6. If you're running on Ubuntu, you might see `Gtk-Message: Failed to load module "canberra-gtk-module"` in your terminal. Fix this with `sudo apt install libcanberra-gtk-module`.
7. Android device manager wants your user to have access to `/dev/kvm` so `sudo apt install qemu-kvm`, then `sudo adduser $USER kvm`.
8. Reboot
9. Now you can launch android-studio/bin/studio.sh again and you're done with setup.
## Create a new react-native app
1. Run `npm install -g react-native-cli`.
2. Instead of making a new directory then running `npm init` (or `yarn init`) inside of it, use `react-native init MyProjectName`
3. `cd` into the newly created `MyProjectName` directory.
## Running and debugging your react-native app
1. Make you have installed at least one virtual device (emulator) with AVD manager (see https://developer.android.com/studio/run/managing-avds).
2. Launch your desired virtual device in android-studio.
3. Run `npm start` to get the Metro server up and running.
4. Run `react-native run-android` to launch the app on your virtual device.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment