操作系统 – CentOS
$ cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
what’s needed?
OpenJDK
Android-SDK
gradle
装置 Open JDK
# 参考文档
https://openjdk.java.net/install/
# 官网装置阐明
Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
$ su -c "yum install java-1.8.0-openjdk"
The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.
# yum 装置 java
# java-1.8.0-openjdk 只是运行环境,java-1.8.0-openjdk-devel 是开发环境
yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
# 获取 JAVA_HOME
$ which java
/usr/lib/jvm/java-1.8.0-openjdk/bin/java
# JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
# 配置环境变量
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
装置 Android-SDK
# 下载 android sdk 压缩包
# 手动
http://sdk.android-studio.org/ , 抉择你要的版本
#主动
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
# 解压
$ mkdir android-sdk
$ mv android-sdk_r24.4.1-linux.tgz android-sdk/
$ cd android-sdk && tar xzvf android-sdk_r24.4.1-linux.tgz
# 配置环境变量
export ANDROID_HOME=~/android-sdk/android-sdk-linux
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
# 更新下载 android 组件
# 更新全副
android update sdk --no-ui
# 抉择更新
android list sdk --all #列出所有包和对应的序号
android update sdk -u --all --filter 序号 1,序号 2...
# 查看是否装置胜利
adb
装置 gradle
# 下载 gradle 压缩包
# 手动
https://services.gradle.org/distributions/ , 抉择你要的版本
# 主动
wget https://services.gradle.org/distributions/gradle-6.5-bin.zip
# 解压
mkdir ~/local/gradle
mv gradle-6.5-bin.zip ~/local/gradle/
cd ~/local/gradle/ && unzip gradle-6.5-bin.zip
# 配置环境变量
export GRADLE_HOME=~/local/gradle/gradle-6.5
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${GRADLE_HOME}/bin:${JAVA_HOME}:${PATH}
# 查看是否装置胜利
gradle -v