caipivara
2/8/2017 - 4:44 PM

Android - install dependencies to build android projects on linux/ci/other using sdkmanager/android terminal tools

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
# 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
#!/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