Installing Android Studio would be the best solution. However, not everyone has the same budget as you who can afford good laptop/PC. My computer screaming for mercy everytime I installed Android Studio. So, I go with VSCodium.
I’m on Fedora 42 but these can be applied to any other distro with some slight modification.
Prerequisites
We can setup this later, but just put it here before I forgot.
export ANDROID_HOME=$HOME/Android/Sdkexport PATH=$PATH:$ANDROID_HOME/emulatorexport PATH=$PATH:$ANDROID_HOME/platform-tools
echo "export ANDROID_HOME=\$HOME/Android/Sdk" >> ~/.bashrcecho "export PATH=\$PATH:\$ANDROID_HOME/emulator" >> ~/.bashrcecho "export PATH=\$PATH:\$ANDROID_HOME/platform-tools" >> ~/.bashrcJava SDK
Current Android uses JDK 17 although React Native documentation said JDK 11. This is because the JDK related to supported JDK version by Gradle. Well, Gradle 8.5 supports JDK 21 and Android Studio uses jbr-21 (Jetbrains’ JDK). Let me download and install it.
sudo dnf install java-21-openjdk-develInstall Android Commandline Tools
Download it:
export DOWNLOAD_DIR=${PWD}wget https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zipSetup the place
mkdir $ANDROID_HOME/cmdline-toolscd $ANDROID_HOME/cmdline-toolsunzip ${DOWNLOAD_DIR}$/commandlinetools-linux-13114758_latest.zip && mv cmdline-tools latestSetup PATH for convenient:
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
echo "export PATH=\$PATH:\$ANDROID_HOME/cmdline-tools/latest/bin" >> ~/.bashrcWith this, you are now can setup Android.
Install Android SDK
Let’s install Android SDK latest version. See with:
sdkmanager --listCopy the name you want to install later with single quote.
Android Platform
sdkmanager --install 'platforms;android-36'Build Tools
sdkmanager --install 'build-tools;36.0.0'Emulator
sdkmanager --install 'emulator'Run an emulator
I’m targeting Google Pixel 2 with Android Q/10 (API 29). Let’s
Install the image
FInd it
sdkmanager --list | grep android-29Install the image first:
sdkmanager --install 'system-images;android-29;google_apis_playstore;x86_64'Create the AVD:
avdmanager --verbose create avd --force --name "test_phone" --package "system-images;android-29;google_apis_playstore;x86_64" --tag "google_apis_playstore" --abi "x86_64" --device "pixel_2"Run the emulator:
emulator -avd test_phone &Test Drive create A Project
Create the default project
bun x @react-native-community/cli@latest init AwesomeProject && cd AwesomeProjectOn one terminal:
Run it:
bun startOn other terminal:
bun androidI tempted to setup Nativewind. Later.
