Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save borgogelli/8b462e05b264b7c36db1143cb6a1dc2e to your computer and use it in GitHub Desktop.
Save borgogelli/8b462e05b264b7c36db1143cb6a1dc2e to your computer and use it in GitHub Desktop.
Android - install dependencies to build android projects on linux/ci/other using sdkmanager/android terminal tools

1. Download tools

wget https://dl.google.com/android/repository/tools_r25.2.3-linux.zip

2. Install tools to /opt/android-sdk

mkdir /opt/android-sdk
mv tools_r25.2.3-linux.zip /opt/android-sdk
cd /opt/android-sdk
unzip -u tools_r25.2.3-linux.zip

3. Put tools inside path

Put in .bashrc file (root path: /root/.bashrc)

export ANDROID_HOME="/opt/android-sdk" 
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH:"

4. Install your dependencies (check install-deps-with-.sh)

#!/usr/bin/env bash
#
# Install required dependencies with android command
#
for DEP in android-25 \
build-tools-25.0.2 \
tool \
extra-android-m2repository \
extra-android-support \
extra-google-google_play_services \
extra-google-m2repository;
do echo y | android update sdk --no-ui --all --filter $DEP ; done
#!/usr/bin/env bash
#
# Install required dependencies
# sdkmanager can be found in $ANDROID_HOME/tools/bin/sdkmanager
#
for I in "platforms;android-25" \
"build-tools;25.0.3 " \
"extras;google;m2repository" \
"extras;android;m2repository" \
"extras;google;google_play_services"; do
echo "Trying to update with tools/bin/sdkmanager: " $I
echo y | sdkmanager $I
done
sdkmanager --update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment