Skip to content

Instantly share code, notes, and snippets.

@resolritter
Forked from SalahAdDin/Steps.md
Last active December 5, 2024 14:40
Show Gist options
  • Save resolritter/8b8a8b7ccbd119eb4921d8331294a19f to your computer and use it in GitHub Desktop.
Save resolritter/8b8a8b7ccbd119eb4921d8331294a19f to your computer and use it in GitHub Desktop.
React-Native Emulator Setup on Arch Linux

Install Android SDK

  • yay -Sy android-sdk android-sdk-cmdline-tools-latest android-sdk-platform-tools
  • The SDK will be installed to /opt/android-sdk; given ANDROID_HOME='/opt/android-sdk', the following should be added to $PATH:
  "$ANDROID_HOME/tools/bin/"
  "$ANDROID_HOME/platform-tools/"
  "$ANDROID_HOME/cmdline-tools/latest/bin"
  "$ANDROID_HOME/emulator"
  • sudo chmod -R 777 /opt/android-sdk works around permission issues due to the package being installed on /opt

Installing specific SDK versions

Example: Install the SDK for Android 8.1 (v28)

  • exec yes | sdkmanager --licenses && sdkmanager "platforms;android-28" "build-tools;28.0.3" "platform-tools" "emulator" "system-images;android-28;default;x86"

To create a device with a Google Play Store, change "default" to "google_apis_playstore".

Setting up the system for emulators

  • sudoedit /etc/modules-load.d/virtualbox.conf and paste in
vboxdrv
vboxnetflt
vboxnetadp
vboxpci
  • sudo modprobe vboxdrv vboxnetadp vboxnetflt
    • Restart the computer for those modules to be picked up

Creating custom emulators

avdmanager --verbose create avd --force --name and28 --package "system-images;android-28;google_apis;x86" --abi "x86" --sdcard 64M

After that run the emulator with emulator @name (matches the --name used in the command above)

Run the JS server and development server separately

Related to bug https://stackoverflow.com/questions/57313661/stuck-on-info-starting-js-server

In a separate terminal

npx react-native start

In a separate terminal

npm run-script android

Useful links

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