Skip to content

Instantly share code, notes, and snippets.

@jdnichollsc
Last active February 15, 2024 12:42
Show Gist options
  • Save jdnichollsc/08a0d6a1b27962c4c4dd78ffbbfe768c to your computer and use it in GitHub Desktop.
Save jdnichollsc/08a0d6a1b27962c4c4dd78ffbbfe768c to your computer and use it in GitHub Desktop.
Run React Native apps in x86_64 devices using Termux and TermuxArch and running in a Linux chroot

Ok, if you're a newbie like me this is the process (After enable the termux storage permissions):

Initialize TermuxArch

startarch

Create a backup of your pacman configuration

tar zcf mirrorlist.tar.gz /etc/pacman.d/
cp /etc/pacman.conf storage/downloads/pacman.conf
cp /etc/pacman.d/mirrorlist storage/downloads/mirrorlist
// Now you can edit the configuration :)
nano /etc/pacman.conf
nano /etc/pacman.d/mirrorlist

Install pacman packages manually

pacman -S git
pacman -S binutils
pacman -S pkgfile
pacman -S unzip
pacman -S fakeroot
pacman -S nodejs
pacman -S npm
npm install -g yarn // Yarn is a other good option to have
pacman -Syy; pacman -Su; pacman -S jdk8-openjdk

Create a new user to use makepkg command

useradd -m myuser
su myuser
makepkg

Install the tools required to build your app

  • Install android-sdk:
cd ~/
git clone https://github.com/termux/termux-packages.git
./termux-packages/scripts/setup-android-sdk.sh
  • Set Environment Variables
nano $HOME/.bash_profile
# Append these lines at the end of the file:
export ANDROID_HOME=$HOME/lib/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
#end
source $HOME/.bash_profile
echo $ANDROID_HOME
/root/lib/android-sdk  // Yay!

Eureka! You can build react-native apps now from your device! 💯

npm install -g react-native-cli
react-native init AwesomeProject
cd AwesomeProject
react-native run-android

Detect your architecture

uname -m

Update the package list and upgrade

pacman -Syu

@fahadali32
Copy link

Make a video at youtube pls sir that how to install react-native at termux

@bloodykheeng
Copy link

is there a video on YouTube

@jdnichollsc
Copy link
Author

Do you still need that?

@K-cod
Copy link

K-cod commented Apr 12, 2023

Yes pls do make a video, i don't understand the start

@mevadakalpesh
Copy link

Yes please need video

@rkmsnc
Copy link

rkmsnc commented Feb 3, 2024

please let us know the emulator settings

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