upleveled / system-setup

Set up a PERN development environment on Windows, macOS and Linux
28 stars 19 forks source link

Set up Android emulator completely via command line #13

Open karlhorky opened 2 years ago

karlhorky commented 2 years ago

Without installing Android Studio - using:

Potentially useful references:

But getting a working Windows guide may be challenging, maybe it needs manual PATH:

https://www.maketecheasier.com/install-android-sdk-in-windows/

First Notes

# create an issue with these commands - maybe we can get a full working command-line version in the future:

# watchman recommended by React Native docs https://reactnative.dev/docs/environment-setup
# todo: do we need watchman??
brew install watchman
# or, on m1
arch -arm64 brew install watchman

# Version recommended by React Native docs https://reactnative.dev/docs/environment-setup
brew tap homebrew/cask-versions
brew install --cask zulu11

brew install qt
brew install --cask temurin8 android-sdk

brew install --cask temurin11 android-commandlinetools
yes | sdkmanager --licenses
sdkmanager --install "build-tools;32.0.0" platform-tools "platforms;android-30"
sdkmanager --install emulator

This will install the Java JDK, Android Command Line tools and the Android emulator.

If you have a machine with an M1 chip, run the following two lines:

sdkmanager --install "system-images;android-30;aosp_atd;arm64-v8a"
avdmanager create avd --name Pixel_3a_API_30_AOSP --abi "aosp_atd/arm64-v8a" --package "system-images;android-30;aosp_atd;arm64-v8a" --device "pixel_3a"

If you have a machine WITHOUT an M1 chip, run the following two lines:

sdkmanager --install "system-images;android-30;aosp_atd;x86"
avdmanager create avd --name Pixel_3a_API_30_AOSP --abi "aosp_atd/x86" --package "system-images;android-30;aosp_atd;x86" --device "pixel_3a"

To start the emulator, run this:

$HOME/Library/Android/sdk/emulator/emulator -avd Pixel_3a_API_30_AOSP

https://docs.expo.dev/workflow/android-studio-emulator/

Some additional things that may help you:

  1. The React Native CLI Quickstart tab on the React Native environment setup docs
  2. Running npx react-native doctor