Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to package Mac Android automatically

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to package Mac Android automatically, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Prepare the environment to configure the Android ADB environment

With regard to the construction of the entire development environment of Android, the download and installation of SDK will not be discussed here. You can refer to the configuration of the adb environment.

Check here to see if the adb is configured successfully. You can enter it in the terminal.

Copyadb version

Display the following information to prove that the configuration is successful

CopyAndroid Debug Bridge version 1.0.41Version 28.0.3-5475833Installed as / Users/vic/Library/Android/sdk/platform-tools/adb configure Gradle environment

To configure the gradle environment, take a look at my previous article, Mac configuring the gradle environment variable.

Check here to see if the gradle is configured successfully. You can enter it in the terminal.

Copygradle-version

The following information indicates that the configuration is successful

Download and install Jenkins

There are two ways to use it. Refer to Jenkins to build under Mac

Jenkins environment variable configuration left system management-> system settings, go to the system settings page

Environment variables under global properties, add key-value pairs

System Management-> Global tool Settings on the left, go to the global tool settings page 1. Click Add JDK,Name in the column of JDK JDK installations, but it is best to correspond to the version number. JAVE_HOME is set to the installation path of Java under the current Mac. Of course, it can also be set to automatically install 2. Gradle gradle configuration: the same name is best followed by the version number, and GRADLE_HOME is set to the installation directory project configuration of gradle to build a free-style software project.

Click New Task in the left menu, then enter the project name in the new interface, and select the option to build a free-style software project to complete the creation.

Basic project configuration

Click the configuration on the left to see a total of 6 tab from top to bottom. Let's configure the features we want one by one:

General

In the description, we can write a brief introduction to the project.

Parametric construction of "This project is parameterized"

"Discard old builds" discarded the old warehouse

Source code management

Source code management, use github to select git, use svn to select subversion

After clicking add, go to the select authentication page. If there is no ssh key, select the user name and password, and select ssh verification with ssh key (note that the key in the private key,id_rsa file is entered, not the key in the id_rsa.pub). When completed, click add to complete the authentication. Then select the corresponding authentication

The branch of the project, fill in the branch you need

Build trigger

Select Build periodically and enter:

CopyH 2 *

Execute the compilation task periodically, forcing it to be built every day at 2: 00 a. M.

Select Poll SCM, enter

CopyH/5 *

It means to check for source code changes every 5 minutes.

> the first parameter represents minute minute, with a value of 0: 59; > the second parameter represents hour hour, with a value of 0: 23; the third parameter represents day day, with a value of 1: 31; the fourth parameter represents monthly month, with a value of 1: 12; and the last parameter represents week week, with values of 0-7, 0 and 7 indicate Sunday. Build the environment

Here you can set up some project information, such as deleting the working directory before building, setting the build name, and so on. (but I didn't set it)

Construction

Add build steps and select Invoke Gradle script (compile)

Gradle chooses your configured version

Fill in the statement that the build executes in the Task (note: do not select Use Gradle Wrapper), usually fill in "clean assembleRelease". Clean first and then build

CopycleanassembleReleaseChannels-PchannelFile=markets.txt

Enter the location where you want the package to be generated in Root Build script and the path to the project's build.gradle in Build File. That is, add / build.gradle after the Root Build script path, and you don't have to enter these two items. The project will have a default build address, which can be checked in the system management of jenkins.

Continue to add the build step, select "Execute shell" and fill in the command (upload dandelion)

Copy./gitswitch dev/cicd Sourcefilepath= `pwd` / app/build/outputs/channels/*pgy*.apkfile= `ls $filepath`if [$uploadPgy = true] then curl-F "installType=2" > Post-build operation

Archive the artifacts (archived finished product), enter content

Copy**/app/build/outputs/channels/*.apk, * * / apk-checker-result.* upload dandelion

Add a build step, select Execute shell, and fill in the command

Copy./gitswitch dev/cicd Sourcefilepath= `pwd` / app/build/outputs/channels/*pgy*.apkfile= `ls $filepath`if [$uploadPgy = true] then curl-F "installType=2"-F "password=alpha"-F "file=@$file"-F "uKey=542e73b113b5908da8b028805bf7e837"-F "_ api_key=8e860ee5ba4996f9b19e56c28e07846a" https://qiniu-storage.pgyer.com/apiv1/app/uploadfi

Dandelion official document address https://www.pgyer.com/doc/api#uploadApp

Debug

Construction history-> console output, you can view the build log and locate the problem according to the error report.

On how to automatically package Mac Android to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report