Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Java 8, Android command line tools and SDK for Ubuntu #188

Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions build_container/build_container_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,60 @@ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# TODO(phlax): use hashed requirements
pip3 install -U pyyaml virtualenv

function install_android_tools() {
#############
# Install JDK
#############

# Add Azul's public key
apt-key adv \
--keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys 0xB1998361219BD9C9

# Download and install the package that adds
# the Azul APT repository to the list of sources
curl -O https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb

# Install the Java 8 JDK
apt-get install -y ./zulu-repo_1.0.0-3_all.deb
apt-get update -y
apt-get install -y zulu8-jdk
rm ./zulu-repo_1.0.0-3_all.deb

#######################
# Install Android tools
#######################

sdk_install_target="/github/home/.android"
mkdir -p "$sdk_install_target/sdk"
pushd "$sdk_install_target"

cmdline_file="commandlinetools-linux-7583922_latest.zip"
curl -OL "https://dl.google.com/android/repository/$cmdline_file"
unzip "$cmdline_file"
mkdir -p sdk/cmdline-tools/latest
mv cmdline-tools/* sdk/cmdline-tools/latest

ANDROID_HOME="$(realpath "$sdk_install_target/sdk")"
SDKMANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager

echo "y" | $SDKMANAGER --install "ndk;21.4.7075529"
$SDKMANAGER --install "platforms;android-30"
$SDKMANAGER --install "build-tools;30.0.2"

export "ANDROID_HOME=${ANDROID_HOME}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think these wont be available in the container env when it is run and dont seem to be used in the build

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll look into how to set env variables in Docker from a bash script then.

the intention is to have these set when the container runs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you want to set them as ENV vars in the Dockerfile and then you can use them here and at runtime

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 6f3544f.

export "ANDROID_SDK_ROOT=${ANDROID_HOME}"
export "ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/21.4.7075529"

popd
}

case $ARCH in
'x86_64' )
install_android_tools
;;
esac

source ./build_container_common.sh

# Soft link the gcc compiler (required by python env)
Expand Down