Ok, if you're a newbie like me this is the process (After enable the termux storage permissions):
startarch
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
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
useradd -m myuser
su myuser
makepkg
- 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
Has anyone successfully managed to build react-native apps with Termux? I've tried with Arch and Debian proot and the standard terminal instance to no avail... I've gotten close but it essentially fails at probably anything to do with cmake, but specifically the react native reanimated library.
I think the ndk needs to be built specifically for the architecture but I'm using a prebuilt one and honestly C and C++ are kind of out of my scope of experience so I can't figure out how to successfully configure the CMakeLists.txt for that library to do the right thing on Android or how to configure (or which to configure) the build.gradle to properly recognize C and C++ environment variables to use the correct toolchains in the suggested ndk by Izhiyong.
Anyone have more knowledge or experience of actually getting this to work?
Oh I guess I should state I was trying to simply get a base minimal default Expo project to build.