gradle环境搭建


操作系统 - 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

你可能感兴趣的:(gradle环境搭建)