This is written under the presumption you're using an aarch64 device like a phone or an nvidia shield to build artifacts, and the SmartTube project root is your current PWD.
If you're using a different system architecture, you'll need to substitute aarch64 jdk/sdk builds for your current arch
SmartTube requires JDK 14 or older for unspecified reasons ( "newer could cause app crash" )
- Download the ARM64 archive locally:
curl -L -o .jdk14.tar.gz \ "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_aarch64_linux_hotspot_14.0.2_12.tar.gz" - Extract somewhere writable (e.g.
/tmpon Termux/Android environments avoids symlink restrictions):tar -xf .jdk14.tar.gz -C /tmp mv /tmp/jdk-14.0.2+12 /tmp/jdk14
- Point Gradle commands at the portable JDK when building:
JAVA_HOME=/tmp/jdk14 \ ANDROID_SDK_ROOT="$PWD/.android-sdk" \ bash ./gradlew :common:compileStstableDebugJavaWithJavac
sdkmanager requires Java 17, so we need to keep a separate JDK 17 install alongside the JDK 14 toolchain.
- Download and extract:
curl -L -o jdk17.tar.gz \ "https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz" tar -xf jdk17.tar.gz -C /tmp mv /tmp/jdk-17.0.12 /tmp/jdk17 - Use this JDK only when invoking the Android command line tools:
JAVA_HOME=/tmp/jdk17 \ PATH="$JAVA_HOME/bin:$PATH" \ ./cmdline-tools/latest/bin/sdkmanager --list
- Download the Android command line tools archive into the project root:
curl -L -o commandlinetools-linux.zip \ "https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip" - Extract into
.android-sdk/cmdline-tools/latest:mkdir -p .android-sdk/cmdline-tools unzip commandlinetools-linux.zip -d .android-sdk/cmdline-tools mv .android-sdk/cmdline-tools/cmdline-tools .android-sdk/cmdline-tools/latest
- Install required packages with the portable JDK 17:
JAVA_HOME=/tmp/jdk17 \ PATH="$JAVA_HOME/bin:$PATH" \ .android-sdk/cmdline-tools/latest/bin/sdkmanager \ "platforms;android-33" \ "build-tools;30.0.3" \ "platform-tools"
- Accept licenses once:
JAVA_HOME=/tmp/jdk17 \ PATH="$JAVA_HOME/bin:$PATH" \ yes | .android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses
Create or update local.properties in the project root so Gradle resolves the portable SDK:
sdk.dir=.android-sdk- Building the project:
JAVA_HOME=/tmp/jdk14 \ ANDROID_SDK_ROOT="$PWD/.android-sdk" \ bash ./gradlew assembleStstableDebug - Managing SDK packages:
JAVA_HOME=/tmp/jdk17 \ PATH="$JAVA_HOME/bin:$PATH" \ .android-sdk/cmdline-tools/latest/bin/sdkmanager --update
Keep both JDK archives within the repository (or a sibling directory) so the setup remains portable across machines. Update the paths above if you relocate the extracted folders.