Closed Filyus closed 5 years ago
Note that the build script already does npm install of android modules. You could try wiping node_modules and do not npm install; only run the build script.
Thanks, Avaer!
Finally the working sequence:
#!/bin/bash
cd /opt echo "Downloading Android SDK..." wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip unzip sdk-tools-linux-4333796.zip -d android-sdk rm sdk-tools-linux-4333796.zip
echo "Updating Android SDK..." cd android-sdk/tools/bin echo y | ./sdkmanager --update
cd /opt/android-sdk/tools/bin mkdir -p ~/.android touch ~/.android/repositories.cfg
echo "Installing platform tools from 21 to latest" ./sdkmanager "platform-tools" for platform in $(./sdkmanager --list | grep platforms | cut -d'|' -f1); do if [ "$(echo $platform | cut -d'-' -f2)" -ge "21" ]; then ./sdkmanager "$platform" fi done
echo "Installing build tools" for build in $(./sdkmanager --list | grep build-tools | cut -d'|' -f1); do ./sdkmanager "$build" done
echo "Installing extra repositories" for repository in $(./sdkmanager --list | grep extras | cut -d'|' -f1); do ./sdkmanager "$repository" done
cd /opt echo "Downloading Android NDK..." wget https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip unzip android-ndk-r20-linux-x86_64.zip mv android-ndk-r20 android-ndk rm android-ndk-r20-linux-x86_64.zip
echo "Creating system variables" export ANDROID_HOME=/opt/android-sdk export ANDROID_NDK_HOME=/opt/android-ndk export ANDROID_TOOLS=/opt/android-sdk/tools/bin export ANDROID_PLATFORM_TOOLS=/opt/android-sdk/platform-tools export PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:$ANDROID_NDK_HOME
echo "export ANDROID_HOME=/opt/android-sdk" >> ~/.bashrc echo "export ANDROID_NDK_HOME=/opt/android-ndk" >> ~/.bashrc echo "export ANDROID_TOOLS=/opt/android-sdk/tools/bin" >> ~/.bashrc echo "export ANDROID_PLATFORM_TOOLS=/opt/android-sdk/platform-tools" >> ~/.bashrc echo "export PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:$ANDROID_NDK_HOME" >> ~/.bashrc
echo "New system variables: ANDROID_HOME, ANDROID_NDK_HOME, ANDROID_TOOLS, ANDROID_PLATFORM_TOOLS"
5. Fix pathes in C:\exokit\scripts\oculusmobile\build-android.sh:
TOOLCHAIN="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64" cd "$(dirname "$0")"
export TOOLCHAIN_USR="$TOOLCHAIN/sysroot/usr" export TOOLCHAIN_LIB=$TOOLCHAIN/sysroot/usr/lib export TOOLCHAIN_LIB_CXX=$TOOLCHAIN_LIB/aarch64-linux-android/lib export TOOLCHAIN_LIB_64=$TOOLCHAIN_LIB/aarch64-linux-android/lib64
export TOOLCHAIN_INCLUDE_SYSROOT=$TOOLCHAIN/sysroot/usr/include export LD_LIBRARY_PATH="./Release:.:$LD_LIBRARY_PATH"
export CC_target="aarch64" export GYP_CROSSCOMPILE=1 export CLANG_CXX_LIBRARY="libstdc++" export CC="$TOOLCHAIN/bin/aarch64-linux-android21-clang" export CXX="$TOOLCHAIN/bin/aarch64-linux-android21-clang++" export LINK="$TOOLCHAIN/bin/aarch64-linux-android21-clang++" export AR="$TOOLCHAIN/bin/aarch64-linux-android-ar" export LD="$TOOLCHAIN/bin/aarch64-linux-android-ld"
6. Execute commands from Ubuntu bash:
sudo su
apt-get update apt-get install -y \ build-essential wget python libglfw3-dev libglew-dev libfreetype6-dev libfontconfig1-dev uuid-dev libxcursor-dev libxinerama-dev libxi-dev libasound2-dev libexpat1-dev
sudo apt update sudo apt-get install -y openjdk-8-jdk sudo update-alternatives --config java
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") echo "export JAVA_HOME=$JAVA_HOME" >> ~/.bashrc
/mnt/c/exokit/scripts/install-sdk-ndk.sh yes | sdkmanager --licenses
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash bash --login nvm install 11.15.0
/mnt/c/exokit/scripts/oculusmobile/build-android.sh
Describe the bug What happened, and what did you expect to happen? I am trying to compile an apk but nothing happens.
To Reproduce Steps or commands ran to reproduce the behavior:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash bash --login nvm install 12.2.0
apt-get update apt-get install -y \ build-essential wget python libglfw3-dev libglew-dev libfreetype6-dev libfontconfig1-dev uuid-dev libxcursor-dev libxinerama-dev libxi-dev libasound2-dev libexpat1-dev
sudo apt update && sudo apt install -y android-sdk export ANDROID_HOME="/usr/lib/android-sdk/" export PATH="${PATH}:${ANDROID_HOME}tools/:${ANDROID_HOME}platform-tools/"
mkdir /mnt/c/android_ndk cd /mnt/c/android_ndk wget -c https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip unzip android-ndk-r20-linux-x86_64.zip export PATH=${PATH}:/mnt/c/android_ndk/android-ndk-r20
cd /mnt/c git clone https://github.com/exokitxr/exokit.git cd /mnt/c/exokit npm install
cd /mnt/c/exokit npm install nvm install 11.15.0 /mnt/c/exokit/scripts/oculusmobile/build-android.sh