Common Linux Commands

  • View the current directory path
pwd
Copy the code
  • The find command is used to search for files, strings, and directories. In the following example, the find command searches for the word androidTest in the “/” partition and returns the output.
# find / -name androidTest / root /. Gradle/wrapper/dists/gradle 5.6.4 - all/ankdp27end7byghfw1q2sw75f/gradle - 5.6.4 / samples/kotlinDsl/androidBuild/app/s rc/androidTest / root /. Gradle/wrapper/dists/gradle 5.6.4 - all/ankdp27end7byghfw1q2sw75f/gradle - 5.6.4 / samples/kotlinDsl/androidSingleBuild /src/androidTestCopy the code

Install and configure the Java environment

  • Download the corresponding JDK version from the Java official websitejdk-8u121-linux-x64.tar.gz
  • Unpack thetar -zxvf jdk-8u121-linux-x64.tar.gz
  • Check the directory
# pwd
/usr/local/java/jdk1.8.0_121
Copy the code
  • Configure Java environment variables, add at the end, save, and then executesource /etc/profileTo take effect
# vi /etc/profile

Copy the code
# Java export JAVA_HOME=/usr/local/ Java /jdk1.8.0_121 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH # source /etc/profileCopy the code

Install and configure the Android environment

  • Download the android SDK

You can only download the previous version of Android -sdk_r24.4.1-linux.tgz download link

  • Unpack the

The tar - ZVXF android - sdk_r24. 4.1 - Linux. TGZ

  • Configure the Android environment variables, add at the end, save, and then executesource /etc/profileTo take effect
# java
...

# android
export ANDROID_HOME=/usr/local/androidsdk/android-sdk-linux
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH



# source /etc/profile

Copy the code
  • The problem

In the later use, there will be the following problems

Failed to install the following Android SDK packages as some licences have not been accepted

cd /usr/local/androidsdk/android-sdk-linux/tools/bin

./sdkmanager --licenses

Copy the code

The SDK version is too low. You need to upgrade the SDK by running commands

Install Jenkins

  • Create the following folder and change the directory permissions
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
Copy the code
  • Download Jenkins
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

yum install -y jenkins
Copy the code
  • The configuration file
JENKINS_PORT="9000" # JENKINS_USER="root"Copy the code
  • Start the
# # start systemctl start Jenkins restart systemctl restart Jenkins # check services, according to instantaneous trip (process) dynamic ps - ef | grep JenkinsCopy the code
  • Open the

Visit Jenkins HTTP :127.0.0.1:9000 and follow the instructions to install the recommended plug-in options

  • Global Tool ConfigurationJAVA_HOME

  • System configuration, configure global properties, configureANDROID_HOME

  • Creating an Android project

Configure Jenkins related variable This project is parameterized

Channel type

Compile type

Git ParameterIt needs to be installed in the plug-in marketplace

  • Git configuration

  • build

There are problems in the following reference, and it is modified as:

clean
--no-deamon
-info
assemble${Flavor}${BuildType}
Copy the code

  • Post-build operation

  • Begin to build

The problem

Jenkins exception Gradle Build Daemon Disappeared unexpectedly

Package command adds:

--no-deamon
Copy the code

Your Jenkins data directory “/var/lib/Jenkins” (AKA JENKINS_HOME) is running out of space. You should do something about it before it’s fully loaded.

Discard old Builds:

Number of days to keep a build: 2

Maximum number of keep builds: 2

Retention period of release packages: 5

Maximum number of builds reserved for release package: