sh Android - 安装依赖项,使用sdkmanager / android终端工具在linux / ci / other上构建android项目
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Android - 安装依赖项,使用sdkmanager / android终端工具在linux / ci / other上构建android项目相关的知识,希望对你有一定的参考价值。
# 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-<tool>.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
以上是关于sh Android - 安装依赖项,使用sdkmanager / android终端工具在linux / ci / other上构建android项目的主要内容,如果未能解决你的问题,请参考以下文章