Set up APK timing automatic Packaging system third--code automatic updating, app automatic packaging system

Source: Internet
Author: User
Tags svn client svn update

Our idea is that each member of the team uploads their code to SVN at a specified time (for example, 18:30) and then updates the code at a specified time (for example, 18:30), executes the ant Packaging command, Finally, the APK package will be stored in the specified directory (or upload the specified FTP directory), other departments or colleagues can access the specified address to download the latest APK package. is to create a timed task in the Ubuntu system, which executes a written compilation script every day at a specified time. This timed task can be implemented in Ubuntu using Crontab. (I don't know crontab's classmates have their brains mended)

First, the Environment preparation

1, build the environment in Ubuntu 12.04.

the steps for ant to build Android under Linux can be consulted "Set up APK timing automatic packaging system" The first--ant multi-channel packaging and specifying the packaging directory and packaging date and the set up APK timing Automatic Packaging System second article--Automatically upload files "this post. Although this post is operating on Windows, the steps are similar. It is believed that as a clever procedural ape this can be extrapolate.

2, set up a good apk build environment after we want to install the SVN client. Unbuntu installing SVN is simple. Execute the following command

sudo apt-get install subversion

After the wait is complete, execute the following command

SVN--version

If the SVN version and related help are available, SVN is already installed.

Second, the installation of Apache services

Since my Ubuntu server is already bound to the corporate intranet IP (192.168.0.115), as long as I store the APK package in the specified directory (such as APK), then other colleagues can be used in the browser 192.168.0.115/ apk to view or download the already-wrapped apk.

1, install Apache service.

It's also easy to install Apache services in Ubuntu.

sudo apt-get install apache2

After installation, the Apache service is automatically opened and its external directory is accessed by default in the/var/www/directory, so enter localhost in the browser and it work! The Apache service installation succeeded

1, modify the Ant.properties

In this file we specify an APK to save the directory as a directory under the Apache service

Key.store=./test.keystorekey.alias=test.keystorekey.store.password=testkey.alias.password=testapk.dir=/var/www /apkapp.name=antdemo#channel Numbersmarket_channels=default_channel

This way, Ant will be able to access 192.168.0.115/apk to download the latest APK package as long as it is a company intranet colleague.

Second, write the APK compilation execution script

set up APK timing automatic packaging system first--ant multi-channel packaging and specifying the packaging directory and date of packaging in the post, we are using

Ant Deploy

To be packaged. So the idea of our script is also very simple, first use the SVN Update Project code, and then use the ant Deploy command.

1. Create a new build-app.sh file under the project root directory (for example, my project directory is/data/appworks/antdemo). The contents of the file are as follows:

#!/bin/shexport java_home=/data/dev/jdkexport ant_home=/data/dev/antexport path= $JAVA _home/bin: $ANT _home/bin:$ pathcd/data/appworks/antdemo/#update echo "Updating code from server." SVN update--username your SVN username--password svn password, without omitting echo "Update Finish.begin building the project." #deployant Deployecho "Building app is finishing."

The blue section above must be set, otherwise crontab will not execute this script. This problem has plagued the landlord for a long time. Remember, remember!

After writing the shell script, add execute permission to build-app.sh.

chmod +x build-app.sh

Then under the project directory manually execute the next script to see if there is any mistake, if it can be packaged successfully, then the script is correct.

2, create crontab task.

Use the following command to edit a crontab task

Crontab-e

This time in the shell opened the crontab edit state of the page, after this page insert the following instructions

* * * */data/appworks/antdemo/build-app.sh

Then edit, save

At this time crontab will execute the packaging command in the 18:30 execution/data/appworks/antdemo/build-app.sh per day.

Set up APK timing automatic Packaging system third--code automatic updating, app automatic packaging system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.